On 3 September 2010 01:27, Connor Baskauskas
<lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>
wrote:> You can take a look at the app I''m referring to at:
> http://github.com/585connor/QA
>
> So, I''ve built this question & answer app... kind of. I can
get the
> answers to be listed on their respective questions but I cannot figure
> out how to get the user info to be displayed on those questions/answers.
> For example I''d like to put the username next to each answer and
the
> username next to each question. Also, when viewing the show action of
> the users controller, I''d like to be able to see a list of that
> particular user''s questions and answers.
>
> There are three tables: questions, answers and users. Can you take a
> look at the github repository and try to point me in the right direction
> for what steps I should take/concepts I should learn in order to achieve
> what I''m trying to do?
I may be wrong but I think you may find it difficult to get someone
to go to the trouble of looking at your whole app in order to
understand your problem. For me, at least, you would be better to
provide the model relationships (has_many, belongs_to etc) and try and
reduce your problem to it''s simplest level. The less extraneous
detail the better. So for example exactly where you want to show the
username is not relevant to the question, I think what you want to ask
is ''if I have an answer how do I determine the username for that
answer?'' That depends only on the model relationships. It is even
possible that in the act of trying to refine exactly what question you
are trying to ask you might well realise that you know the answer
already.
Have you read the Rails Guides on ActiveRecord Associations? That may
well help.
Colin
--
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.