Module: Reform::Form::ActiveRecord

Defined in:
lib/reform/form/active_record.rb

Defined Under Namespace

Modules: ClassMethods Classes: UniquenessValidator

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



2
3
4
5
6
7
# File 'lib/reform/form/active_record.rb', line 2

def self.included(base)
  base.class_eval do
    include Reform::Form::ActiveModel
    extend ClassMethods
  end
end

Instance Method Details

#model_for_property(name) ⇒ Object



37
38
39
40
41
42
# File 'lib/reform/form/active_record.rb', line 37

def model_for_property(name)
  return model unless is_a?(Reform::Form::Composition) # i am too lazy for proper inheritance. there should be a ActiveRecord::Composition that handles this.

  model_name = mapper.representable_attrs[name][:on]
  model[model_name]
end