Sha256: fc7c32346b6c7e42dd8d17945593beff2c9b555f59377e79eb4c91079032a376
Contents?: true
Size: 620 Bytes
Versions: 1
Compression:
Stored size: 620 Bytes
Contents
module Emotions module Emotive extend ActiveSupport::Concern module ClassMethods def acts_as_emotive has_many :emotions, as: :emotive, class_name: 'Emotions::Emotion' class_eval <<-RUBY, __FILE__, __LINE__ + 1 def emotional_about self.emotions.includes(:emotional) end RUBY Emotions.emotions.each do |emotion| class_eval <<-RUBY, __FILE__, __LINE__ + 1 def #{emotion}_about emotional_about.where(emotion: #{emotion.to_s.inspect}) end RUBY end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
emotions-0.1 | lib/emotions/emotive.rb |