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” (

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

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


rubynuby wrote: