Rails not editable text field Rails not editable text field ruby-on-rails ruby-on-rails

Rails not editable text field


Make it readonly !

<%= location.text_field :country,:readonly => true%>


The trick is to use "object" in conjunction with a label for anything you don't want to change. Here is how you should code it:

<%= location.label(:country, f.object.country) %>