This is the question
I have a Event model and a User model.
An Event has one creator of class User. I used this line in Event model to associate it:
belongs_to :creator, :class_name => "User"
So I can access the creator through this line:
event.creator
My User decorator has this line:
def full_name
"#{first_name} #{last_name}"
end
So I can decorate an User object and access user.full_name
But I need to decorate an event, and use "decorates_association" to decorate the associated User. So I need to call this line:
event.creator.full_name
I have tried this:
decorates_association :creator, {with: "UserDecorator"}
decorates_association :creator, {with: "User"}
But it throws and "undefined method `full_name'" error.
How can I prevent this error?
Thank you!