Formtastic 0.9.5 breaks select fields for belongs_to associations #146

Closed
tfolk opened this Issue Dec 2, 2009 · 6 comments

4 participants

@tfolk

I have the following model

class Address < ActiveRecord::Base
  belongs_to :country
  #etc...

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:
#etc...

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.

@KieranP

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

@grimen

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.

@grimen

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

@grimen

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

@justinfrench
Owner

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.
a9651db
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment