Hi, I have the following situation, 3 tables as follows: TableA: TableB: TableC: ------- ------- ------- TableB_ID User_ID User_ID User_Name TableB_ID is a foreign key to TableB, User_ID in TableB and TableC is foreign key to a table that play no role hier. now I would like to display the User_Name field found in TableC in a e.g index view. So I need to go from TableA with the TableB_ID foreign key to get the User_ID field from TableB, then search for the record in TableC that has this User_ID as one of its fields and get the User_Name. This should look something like: <td><%= TableA.TableB.TableC(where TableB.User_ID = TableC.User_ID).User_Name %></td> I know that the syntax above is not correct but just to show what I''m looking for. Hope I made my self clear ;-) Thanks Dani <td><%= course_attendee.sys_title.name unless course_attendee.sys_title.nil? %></td> -- Posted via http://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 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.
Do you have these set up as models in your application? Perhaps you should take a look at the Rails Guides, specifically the ones on Models http://guides.rubyonrails.org/active_record_querying.html -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/iNhtj2C_rXwJ. 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.
On 14 September 2011 21:30, Tim Shaffer <timshaffer-BUHhN+a2lJ4@public.gmane.org> wrote:> Do you have these set up as models in your application? > Perhaps you should take a look at the Rails Guides, specifically the ones on > Models > http://guides.rubyonrails.org/active_record_querying.htmlIt might even be better to start with the one on ActiveRecord Associations http://guides.rubyonrails.org/association_basics.html Colin -- gplus.to/clanlaw -- 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.