DEV Community

Discussion on: Create a Basic API with Ruby on Rails

decentralizuj profile image
decentralizuj • Edited on

Nice comment... Instance variables make sense in controllers, so could be used in views:

@band    = Band.find_by(id: params[:id])
@guitars = Guitar.where(band_id:
Enter fullscreen mode Exit fullscreen mode

Now we can see band's guitar on band page.

In API, this is done by Serializers.