Hii mac (manmohan ), thanks for answer you have given me the method to find out to content master listing of tag id 1 but i want the content master listing of all which are associated with tag id 1,2
please help in this regard On Apr 15, 9:16 pm, mac <[email protected]> wrote: > hello Rahul, > > On Apr 15, 5:58 pm, Rahul Mehta <[email protected]> wrote: > > > i have two module both are joined byHABTMname are tags and > > content_masters > > i have content_master .id and i want to get all the content_masters > > which are with the same tag as that id has . > > if it is joined by has_and_belongs_to_many , then you can simply do > this by > @content_master = ContentMaster.find(1) # id= 1 is just taken as > example > �...@content_master.tag # this will give > you array of all the tags that are assosiated to id 1 > > in the case you want reverse then > > @tag = Tag.find(1) # assuming tag to be a > model > @tag.content_master # this will give you array of > all the content_master assosiated with tag_id = 1 > > hope this helps > > mac -- 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.

