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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
try
@post.user.email, assuming your models have right associations