11 ms·
I think there is a more Rails-y way to do this. Derek Prior gave an excellent talk[1] at the recent RailsConf. The TLDW is "all-REST all-the-time." Applying
by jonathanhefner 9y ago
I think there is a more Rails-y way to do this. Derek Prior gave an excellent talk[1] at the recent RailsConf. The TLDW is "all-REST all-the-time." Applying this principal to the example in the article, instead of adding a custom `movie_rating` action, you would create a `MovieRatingsController` with a `show` action.
Additionally, you might create an SJR[2] template which injects the rating directly into the page, possibly avoiding the need for a separate gem.
[1] https://www.youtube.com/watch?v=HctYHe-YjnE https://www.youtube.com/watch?v=HctYHe-YjnE
[2] https://signalvnoise.com/posts/3697-server-generated-javascript-responses https://signalvnoise.com/posts/3697-server-generated-javascr...