Rails: How to implement single-attribute AJAX updates?

In my Rails application, I need single-attribute AJAX updates, for example. "Click on the row label in the table to switch the public / private flag." What is the best strategy to implement this? Use update method in controller or custom method?

+4
source share
1 answer

If you have no good reason to use a custom method, just use the regular update by sending a typical object[attr] = value payload. It is simple, works out of the box and adheres to REST.

+4
source

All Articles