Module: Extensions::Conditional::ActiveRecord::Base::ClassMethods

Defined in:
lib/extensions/conditional/active_record/base.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_conditionObject

Declare this function in the condition model


15
16
17
18
19
20
# File 'lib/extensions/conditional/active_record/base.rb', line 15

def acts_as_condition
  acts_as :condition, class_name: Course::Condition.name

  include ConditionInstanceMethods
  extend ConditionClassMethods
end

#acts_as_conditionalObject

Functions from conditional-and-condition framework. Declare this function in the conditional model that requires conditions.


6
7
8
9
10
11
12
# File 'lib/extensions/conditional/active_record/base.rb', line 6

def acts_as_conditional
  has_many :conditions, -> { includes :actable },
           class_name: Course::Condition.name, as: :conditional, dependent: :destroy,
           inverse_of: :conditional

  include ConditionalInstanceMethods
end