ruby on rails - How to use reform gem with two models that share identical column names -
i using reform gem , want create 2 objects (an instance of foo, , 1 of bar) both have 'name' attribute:
class marflarform < reform:form include dsl include reform::form::activerecord property :name, on: :foo property :name, on: :bar end
but cant obvious reasons:
= simple_form_for @form |f| = f.input :file = f.input :file
the way can think of getting round renaming 1 of database columns 'title'. there way?
its simple, achieve goal please use:
class marflarform < reform:form include dsl include reform::form::activerecord property :name, on: :foo property :name, on: :bar end
and in view
= simple_form_for @form |f| = f.input "foo[name]" = f.input "bar[name]"
this avoid name collision.
Comments
Post a Comment