I'm building a Rails
API and I would like to know if there is a way to return the attributes of my object, but I don't want to return all of the attributes. Is there a way to prevent certain attributes from being returned? For example, I would not want to return the database IDs or the timestamps
Have a nice day.
How about calling the except
method on your object attributes:
your_object.attributes.except('id')