r2cqhg
Last Updated: February 25, 2016
·
3.783K
· lexmag
0ahwc6a0nvi7y6x1i4c4

Don't 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" }
Say Thanks
Respond