Hey, nice tuto. It's impressive how simple is to build a REST API with Ruby on Rails. Love it.
I also think you hit a good point by mentioning a standard way to output JSON when scaling or the API is getting big. JSON output is one of those things that no one agrees how to return them 😅
Suggestion: do not use instance variable in API controllers. In Rails (IMO), they make more sense when working with views.
# Do thisdefindexbands=Band.allend# instead of defindex@bands=Band.allend
Hey, nice tuto. It's impressive how simple is to build a REST API with Ruby on Rails. Love it.
I also think you hit a good point by mentioning a standard way to output JSON when scaling or the API is getting big. JSON output is one of those things that no one agrees how to return them 😅
Suggestion: do not use instance variable in API controllers. In Rails (IMO), they make more sense when working with views.
Nice comment... Instance variables make sense in controllers, so could be used in views:
Now we can see band's guitar on band page.
In API, this is done by Serializers.