I have a model Post
with an attribute published_at
.
However, in POST request API requires it to be assigned as published
, not published_at
.
So in my model I override setter method like so
def published=(value)
self.published_at = value
end
The problem is, in my API tests, I use FactoryGirl's attributes_for(:post)
method to generate attributes for POST request, and it uses old published_at
name. How can I workaround this problem and generate attributes with published
key instead of published_at
without changing the name of this attribute in my model?