Batman
Batman

Reputation: 6353

ActiveModel Serialization not taking effect

I'm trying to render how the specific attributes but all attributes are getting returned, it seems like AMS isn't having any effect.

Serializer:

class ImagesSerializer < ActiveModel::Serializer
  attributes :id, :facility_id, :title, :description
end

Upvotes: 1

Views: 53

Answers (1)

Aleksey Shein
Aleksey Shein

Reputation: 7482

Your serializer should be called ImageSerializer (note absence of s), because your model is named Image.

And make sure the file is put under app/serializers/image_serializer.rb.

Upvotes: 2

Related Questions