On 27 August 2012 19:39, Brian Ekmark <brian.ekmark@gmail.com> wrote:
> Greetings --
>
> I am very new to RoR and I am reaching out for some assistance. I am
> creating a task management web app to practice and I'm not sure if I am
> running into more of a syntax issue or a design issue. The problem I am
> having is that I am trying to reference a task for a specific user. I have
> two seperate tables for both the users and the tasks, but on the task create
> method I also write to a third table which ties the user to the task via
> their own id. I have been able to keep the creation and the destory in sync,
> but the problem is that I'm not sure how to display the contents of the task
> record from the third table which ties the user to the task. Below are some
> specifics if anyone could help me understand this better I would greatly
> appreciate it.
>
> I am trying to link these all together from a home controller. I can find
> the assigned task_id from the reference table, but I don't know how to
> extract the contents of the record:
Since you have not mentioned the associations between the models (user
has_many tasks for example) I guess that you are not familiar with
such concepts. Have a look at the Rails Guide on Associations (and
all the other guides for that matter). In fact I strongly suggest
that you work right through a tutorial such as railstutorial.org,
which is free to use online, which will introduce you to the basic
concepts of rails. Make sure that the tutorial is for at least rails
3 and that you use the correct version for that tutorial. By the end
of that you will likely be able to answer the questions yourself.
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment