Module: ActiveRecord::Rollout::ActsAsFlaggable
- Defined in:
- lib/active_record/rollout/acts_as_flaggable.rb
Instance Method Summary collapse
-
#acts_as_flaggable(options = {}) ⇒ Object
Sets up ActiveRecord associations for the including class, and includes Flaggable in the class.
Instance Method Details
#acts_as_flaggable(options = {}) ⇒ Object
Sets up ActiveRecord associations for the including class, and includes Flaggable in the class.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/active_record/rollout/acts_as_flaggable.rb', line 12 def acts_as_flaggable( = {}) class_eval do @active_record_rollout_flaggable_find_by = :id has_many :flaggable_flags, as: :flaggable, class_name: "ActiveRecord::Rollout::FlaggableFlag" has_many :opt_out_flags, as: :flaggable, class_name: "ActiveRecord::Rollout::OptOutFlag" has_many :features, through: :flaggable_flags, class_name: "ActiveRecord::Rollout::Feature" if [:find_by] @active_record_rollout_flaggable_find_by = [:find_by] end extend ActiveRecord::Rollout::Flaggable::ClassMethods include ActiveRecord::Rollout::Flaggable end end |