I have a table with a user_id field. In find, I created a join
on user table to retreive the username as:
@question = Question.find(params[:id], :select=>"questions.*,
users.username as username",:joins=>" inner join users on users.id =
questions.user_id");
I created an instance variable in Question class with name
username. But I'm not able to access the data. I want to access it as
question.username. can anyone help me out, how to do that?
Also I'm not using associations to get the complete user field, because not needed. Thanks in advance.