I had an issue where the following jquery script was failing in Rails 3.1 due to it not finding the element.
jquery
member_submit_button = $("#member_submit");
haml
= form_for @member do |f|
...
f.submit "Update details", :class => "member_submit_button bluebutton"
In Rails 3.0 this works fine, and I tracked it down to Rails 3.1 not generating the id attribute. In rails 3.0 a tag id = “member_submit”.
This of course is easily fixed by adding the :id => “member_submit” parameter to the f.submit call. But I wanted to know what the reason was for this change as I have not seen this documented anywhere.
I upgraded from Rails 3.0 to 3.1 and noticed one of my specs failing due to the same missing ID attribute.
A bit of googling revealed that this is an expected behaviour for Rails 3.1, as specified in the respective Release Notes (see sect. “5.3 – Action View”):
Even if my message doesn’t answer your question entirely, as I can’t tell you why the Rails team decided to make this change, at least you can be sure that that’s not a Rails defect, but rather a change in that form helper. 😉