Reputation: 19486
So let's say I've got a hypothetical:
@post.user_id
where User has_many posts and I'm using devise,
I'd like to do something like:
@post.user_id.email but this fails; what's the elegant way of getting the email address here?
Upvotes: 1
Views: 31
Reputation: 29165
try @post.user.email
, assuming your models have right associations
Upvotes: 3