Questions tagged as 'active-model-serializers'

2
answers

Rendering a JSON object with the join of different models

I'm developing an API with rails 5 and I have the following models: class cotacao < ApplicationRecord belongs_to :usuario has_many :cotacao_itens, dependent: :destroy accepts_nested_attributes_for :cotacao_itens, allow_destroy: true...
asked by 05.10.2018 / 20:18
1
answer

How to render a json with the json_api adapter using Rails Serializer?

Oops, I would like to render a json using the json_api ( link ) pattern using Rails Serializer ( link ). In my controler I'm rendering something similar to this: render json: {'user': {name: 'Peter' }} However, when I render this JSON, i...
asked by 11.05.2017 / 22:45
1
answer

Association belongs_to inside serializer is not returning anything

The application contains a module called Dispute , this module contains Procedures , each Procedure contains a user and belongs to a dispute. As described below, belongs_to is not displayed and the :user attribute i...
asked by 02.01.2017 / 22:06
0
answers

How to apply serializer to an object generated by FactoryGirl?

I have an object user generated by FactoryGirl like the one below: FactoryGirl.define do factory :user do name { FFaker::NameBR.name } image { FFaker::Avatar.image } email { FFaker::Internet.email } pa...
asked by 22.11.2016 / 13:07