Formtastic 0.9.5 breaks select fields for belongs_to associations #146

tfolk opened this Issue Dec 2, 2009 · 6 comments

4 participants


I have the following model

class Address < ActiveRecord::Base
  belongs_to :country

And the following in the view

= form.input :country, :include_blank=>false, :label_method => :printable_name

In Formtastic 0.9.3 I get the expected output:
#etc... But in 0.9.5, FT is appending a [] to the name attribute:

This causes the controller to misassign the state attribute because it's getting an array which includes the selected value instead of the value itself.


+1 I get around this for the time being by using :input_html => { :name => '.....' } but it's not ideal. Perhaps a test for this ;-)


OK, I got it. For some reason there are missing specs for name attributes. I got this one failing as well, will just trace it down now.


Note: The Rails select helper don't treat :multiple => nil as "no value", the :multiple option key must not exist in such cases. xP


Fixed the mysterious incorrect DOM name generated for select + belongs_to. Closed by a9651db.


Pulled, new gem pushed.

@zuf zuf pushed a commit to zuf/formtastic that referenced this issue Sep 7, 2012
@grimen grimen Fixed the mysterious incorrect DOM name generated for select + belong…
…s_to. Closes #146.
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment