Top "Active-model-serializers" questions

objects.

How to pass parameters to ActiveModel serializer

I'm using active model serializer. I have a model event which has_many activities. I want to return the event …

ruby-on-rails active-model-serializers
Serializing deeply nested associations with active_model_serializers

I'm using Rails 4.2.1 and active_model_serializers 0.10.0.rc2 I'm new to API's and chose active_model_serializers because it seems …

ruby-on-rails json active-model-serializers
How do you initialize an ActiveModel::Serializer class with an ActiveRecord::Relation array?

I have a serializer class FundingSerializer < ActiveModel::Serializer attributes :id, has_one :user has_one :tournament embed :ids, include: …

ruby-on-rails-4 active-model-serializers
<NoMethodError: undefined method `read_attribute_for_serialization' for #<Record::ActiveRecord_Relation:

I'm getting the error: <NoMethodError: undefined method `read_attribute_for_serialization' for #<Record::ActiveRecord_Relation:0x007faa7cfe3318&…

ruby-on-rails active-model-serializers
Serialize an array of models using active_model_serializers

I am trying to send the serialized version of a model to a view as a param, using the gem …

ruby-on-rails json ruby-on-rails-4 active-model-serializers json-api
Conditional attributes in Active Model Serializers

How do I render an attribute only if some condition is true? For example, I want to render User's token …

ruby-on-rails active-model-serializers
Rails Active Model Serializer - has_many and accessing the parent record

I'm trying to build a JSON representation of some Rails models using Active Model Serializer, where some models embed others. …

ruby-on-rails json active-model-serializers
Active Model Serializers belongs_to

This question pertains to AMS 0.8 I've got two models: class Subject < ActiveRecord::Base has_many :user_combinations has_ancestry …

ruby-on-rails active-model-serializers
Make root node in Active Model Serializer

I have an array of JSON in my Rails App in this format using Active Model Serializer: [ { "contact" : {} }, { "contact" : {} } ] How …

ruby-on-rails activerecord active-model-serializers
how to dynamic add attributes on Active Model Serializers

I want to decide numbers of attributes to output in my controller. But I have no idea have to do …

ruby-on-rails-4 active-model-serializers