hello Rahul,

On Apr 15, 5:58 pm, Rahul Mehta <[email protected]> wrote:
> i have two module both are joined by HABTM name 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.

Reply via email to