Sending Better Data With Rails Serializers - DEV Community

Using Ruby on Rails as an API is awesome because of its render :json method. The only problem is that many times the JSON data may contain many unnecessary things. We want more options to customize the data and we can do that using serializers. We can use serializers to format our JSON by selecting only the data that we really need as well as get access to model relationships. Let’s get started.In this example we can imagine that you want to query a list of Pokemon and their trainer from your database. Let’s create two models.
Sending Better Data With Rails Serializers - DEV Community #ruby #rubydeveloper #rubyonrails #dev https://rubyonrails.ba/single/sending-better-data-with-rails-serializers-dev-community

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles