lib/reform/form/active_model.rb in reform-2.0.1 vs lib/reform/form/active_model.rb in reform-2.0.2
- old
+ new
@@ -25,9 +25,24 @@
extend Uber::InheritableAttribute
inheritable_attr :model_options
end
end
+ # DISCUSS: can we achieve that somehow via features in build_inline?
+ def process_inline!(mod, definition)
+ _name = definition.name
+ mod.instance_eval do
+ @_name = _name.singularize.camelize
+ # this adds Form::name for AM::Validations and I18N.
+ # i have a feeling that this is also needed for Rails autoloader, which is scary.
+ # beside that, it is a nice way for debugging to find out which anonymous form class you're working on:
+ # anonymous_nested_form.class.name
+ def name
+ @_name
+ end
+ end
+ end
+
# Set a model name for this form if the infered is wrong.
#
# class CoverSongForm < Reform::Form
# model :song