I have a simple model:
class Receipt
include ActiveModel::Serialization
attr_accessor :products
end
and my controller is doing:
def create
respond_with receipt, :serializer => ReceiptSerializer
end
and the serializer:
class ReceiptSerializer < ActiveModel::Serializer
attributes :products
end
and I get:
NoMethodError: undefined method `to_model' for #<Receipt:0x007f99bcb3b6d8>
Yet if I change my controller to:
def create
json = ReceiptSerializer.new(receipt)
render :json => json
end
Then everything works fine... what is happening???
I was using active_model_serializers 0.9.3, but just tried 0.10.2, and the results are the same.