I have a rails scope that gets the first record of a table and assings it to a @variable. It returns either a single object or an empty Active Record Relation. My problem is that i'm using a custom serializer to render the json but if the scope returns an empty Active Record Relation I get the "Active Record undefined method read_attribute_for_serialization" unless i use each_serializer, but if the the scope returns an object i have to render it using serializer: Is there any way of solving this without doing this : I have a rails scope that gets the first record