how to set a text_field to un-editable in ROR

add a 'disabled' => 'true', e.g.

<%= text_field 'post', 'title', 'size' => 30, 'disabled' => 'true' %>

The XHTML definition clearly states it should be disabled=“disabled” (http://www.w3schools.com/xhtml/xhtml_syntax.asp)

I also prefer the use of symbols for extra parameters.

<%= text_field “post”, “title”, :size => 30, :disabled => “disabled” %>

Best regards

Peter De Berdt

thank you for the correction. I did use symbols in my code but looking at the doc

http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#M000506

it uses strings, so I changed it.

One of the more confusingg aspects of Ruby. sometimes it seems strings and symbols are interchangeable, and sometimes they're not.

If you pass :disabled => true, rails will properly spit out disabled=“disabled”.

-Bill

rubynuby wrote: