On Oct 17, 1:04 pm, "Rahul J." <[email protected]> wrote:

> @question = Question.find(params[:id], :select=>"questions.*,
> users.username as username",:joins=>" inner join users on users.id =
> questions.user_id");
>
> I had created an instance variable in Question class with name
> "username". But i am not able to access the data. I want to access it as
> question.username. can anyone help me out.

you shouldn't need to do anything - AR will create an attribute reader
method for you

Fred

>
> Also i am not preffering associations to get the complete user field, as
> its not being needed.
> Thanks in advance.
>
> --
> Posted viahttp://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to