Do you really have just the id of the content master or do you have
the object itself? If you have a content_master in @content_master
then the associated tags are available as an array in
@content_master.tags.
If you only have the id of the content master then something like
@tags = Tag.find( :all, :include => 'content_masters', :conditions =>
['content_masters.id = ?', content_master.id] )
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
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