Last Updated: April 13, 2020
·
17K
· lexmag

Do not confuse "disabled" input option with "readonly" one

Rails conforms to the HTML convention.

# new.html.slim

= form_for @post do |f|
  = f.text_field :title, value: 'It will never change', readonly: true
  = f.text_field :description, value: 'You will not see it in params', disabled: true
  = f.button :submit

In controller params we will get:

params[:post] # => { "title"=>"It will never change" }