Module: Reform::Form::ActiveModel::ClassMethods
- Included in:
- Composition::ClassMethods
- Defined in:
- lib/reform/form/active_model.rb
Instance Method Summary collapse
-
#model(main_model, options = {}) ⇒ Object
Set a model name for this form if the infered is wrong.
- #model_name ⇒ Object
Instance Method Details
#model(main_model, options = {}) ⇒ Object
Set a model name for this form if the infered is wrong.
class CoverSongForm < Reform::Form
model :song
63 64 65 |
# File 'lib/reform/form/active_model.rb', line 63 def model(main_model, ={}) @model_options = [main_model, ] # FIXME: make inheritable! end |
#model_name ⇒ Object
67 68 69 70 71 72 73 74 75 |
# File 'lib/reform/form/active_model.rb', line 67 def model_name if @model_options form_name = @model_options.first.to_s.camelize else form_name = name.sub(/Form$/, "") end active_model_name_for(form_name) end |