Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Blanks are included in params - v 1.2.5 #883

Closed
RajRoR opened this Issue · 1 comment

2 participants

@RajRoR

I was using formtastic -v 1.2.4 earlier, but this time when I tried to setup my application on another system, bundler installed formtastic -v 1.2.5.

In -v 1.2.4, I not getting params attribute for blank fields and in new verison i.e. 1.2.5, application gets blanks for blank fields due to which my application is crashing.

Please fix it in further verisons.

@justinfrench

Looking at the changelog for 1.2-stable (https://github.com/justinfrench/formtastic/blob/8741d76a95b7adf29d39df41f6d4f015cdd74473/CHANGELOG), I guess you're referring to multi-selects?

The rationale here is that if you unselect all options in a multi-select, the browser will not post the key in the POSTed params at all. Since the key is not in the params, update_attributes and other ActiveRecord internal will not update, so the user's change (deselect all options) is not persisted to the database.

This is a hot topic of debate, but the work here is inline with what Rails does in similar cases (like unselected checkboxes), and it's here to stay. Formtastic 2 does the same thing, and it's beyond the point where I'd consider reverting this behaviour outside of a major release.

The good news is that 1.2.5 is likely the end of the line for 1.2 series, so you can just force 1.2.4, but eventually you'll want to upgrade to Rails 3+ and Formtastic 2+, so would be worth resolving the "crashing" in your app and move forward.

Closing for now, but please re-open if I've missed something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.