I am currently looking for a software/web development job preferably as a Rails-based developer.
Please email me at weston@westonganger.com. Thanks in advance for any leads!

Make SimpleForm Inputs Disabled By Default In Rails

Posted by Weston Ganger

I needed to be able to set a default value for disabled based on a conditional in simple_form

Turns out they have a defaults hash that you can add this stuff. Super awesome!


simple_form_for @foo, defaults: { disabled: (true unless current_user.is_admin?) }

This is much better than setting each input individually or trying to do it through javascript unnecessarily.


Related External Links:

Article Topic:Software Development - Rails

Date:February 27, 2016

Recommended Posts