Module: ActiveForm::Form::ClassMethods

Defined in:
lib/activeform-rails/form.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#main_classObject

Returns the value of attribute main_class.



13
14
15
# File 'lib/activeform-rails/form.rb', line 13

def main_class
  @main_class
end

#main_modelObject

Returns the value of attribute main_model.



13
14
15
# File 'lib/activeform-rails/form.rb', line 13

def main_model
  @main_model
end

#reflected_classObject

Returns the value of attribute reflected_class.



13
14
15
# File 'lib/activeform-rails/form.rb', line 13

def reflected_class
  @reflected_class
end

Instance Method Details

#alias_property(new_method, old_method) ⇒ Object



43
44
45
46
# File 'lib/activeform-rails/form.rb', line 43

def alias_property(new_method, old_method)
  alias_method new_method.to_sym, old_method.to_sym
  alias_method "#{new_method}=".to_sym, "#{old_method}=".to_sym
end

#i18n_scopeObject



23
24
25
# File 'lib/activeform-rails/form.rb', line 23

def i18n_scope
  :activerecord
end

#modelsObject



27
28
29
# File 'lib/activeform-rails/form.rb', line 27

def models
  @models ||= []
end

#properties(*attributes, prefix: false, on: nil) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/activeform-rails/form.rb', line 15

def properties(*attributes, prefix: false, on: nil)
  if on.nil?
    attr_accessor *attributes
  else
    delegate_to_model(attributes, on, prefix)
  end
end