I've just updated to Rails 2.3.2 from Rails 2.1 and noticed an issue with regards to using the :disabled
option on input fields.
Previously we were using this option as a boolean, so we would indicate whether or not we wanted to disable the fields based on a method on the object, e.g.
f.text_field :amount, :disabled => @my_object.is_disabled?, :class => 'my_class'
This works fine in Rails 2.1 -- if is_disabled?
returns true, the form field is disabled, otherwise it's not.
In Rails 2.3 however, this isn't the case. The form field is disabled regardless of the value of :disabled
.
Does this mean I'll have to put an if
statement around my f.text_field
declaration such as:
<% if @my_object.is_disabled? %>
<%= f.text_field :amount, :disabled => 'disabled', :class => 'my_class' %>
<% else %>
<%= f.text_field :amount, :class => 'my_class' %>
<% end %>
Surely I'm missing something here?