Module: Reform::Contract::Setup
- Included in:
- Reform::Contract
- Defined in:
- lib/reform/contract/setup.rb
Defined Under Namespace
Modules: Representer
Instance Method Summary collapse
-
#create_fields(field_names, fields) ⇒ Object
DISCUSS: setting up the Validation (populating with values) will soon be handled with Disposable::Twin logic.
- #initialize(model) ⇒ Object
- #setup_fields ⇒ Object
Instance Method Details
#create_fields(field_names, fields) ⇒ Object
DISCUSS: setting up the Validation (populating with values) will soon be handled with Disposable::Twin logic.
17 18 19 |
# File 'lib/reform/contract/setup.rb', line 17 def create_fields(field_names, fields) Fields.new(field_names, fields) end |
#initialize(model) ⇒ Object
5 6 7 8 |
# File 'lib/reform/contract/setup.rb', line 5 def initialize(model) @model = model # we need this for #save. @fields = setup_fields # delegate all methods to Fields instance. end |
#setup_fields ⇒ Object
10 11 12 13 14 |
# File 'lib/reform/contract/setup.rb', line 10 def setup_fields representer = mapper.new(aliased_model).extend(Setup::Representer) create_fields(representer.fields, representer.to_hash) end |