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" }
Written by Aleksey Magusev
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Filed Under
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#