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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -