I'm trying to add a disabled drop-down box to my table, which I will eventually make conditional. However, disabled doesn't seem to be added to the line when it is run.
If I inspect the element in the page, manually adding disabled works, but it is not being added at run-time.
= f.fields_for(:targets, qualification.target_for(@grandfather.user)) do |builder|
%tr
%td
= builder.select :completed, qualification.level_options.map{|o| [o,o]}, :disabled => "disabled"
= builder.hidden_field :qualification_id, :value => qualification.id
= builder.hidden_field :id
Check out the API for Rails' Form Helper API
select(object, method, choices, options = {}, html_options = {})
It was adding :disabled => "disabled"
to the options, instead of the html_options. This is the code to use instead (notice the empty hash for the options parameter):
builder.select(:completed, qualification.level_options.map{|o| [o,o]}, {}, {:disabled => "disabled"})