In my Rails app, I want single-attribute AJAX updates e.g. “Click on row label in a table to toggle public/private flag”. What’s the best strategy for implementing this? Use the update method in controller or a custom method?
In my Rails app, I want single-attribute AJAX updates e.g. Click on row label
Share
Unless you have some compelling reason to use a custom method, just use the normal update, sending your typical
object[attr] = valuepayload. It’s simple, works out of the box, and adheres to REST.