2009/8/28 Kart <[email protected]>: > > hi all, > consider that I'm having 3 models > 1)user > 2)doc > 3)udoc > > user model=>(id,name) > has_many:udocs > has_many:docs ,through:udocs > > doc Model=>(id,name) > has_many:udocs > has_many:users ,through:udocs > > udoc Model=>(id,user_id,doc_id,start_date,end_date) > belongs_to:user > belongs_to;doc > > Can anybody just tell how to access the extra field (start_date and > end_date) in udocs table > by using User Model
Assuming you have a user in, say, @user, then @user.udocs will give you an array of Udoc objects so you can do things like @user.udocs[0].start_date or @user.udocs.each do |udoc| # do something with udoc.end_date end 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 [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 -~----------~----~----~----~------~----~------~--~---

