Tom Söderlund
Tom Söderlund

Reputation: 4747

Rails: How to implement single-attribute AJAX updates?

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?

Upvotes: 4

Views: 421

Answers (1)

numbers1311407
numbers1311407

Reputation: 34072

Unless you have some compelling reason to use a custom method, just use the normal update, sending your typical object[attr] = value payload. It's simple, works out of the box, and adheres to REST.

Upvotes: 4

Related Questions