Issues with Relationships

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?

On 3 September 2010 01:27, Connor B. [email protected]
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