I am new in Rails, I have 3 models in the application namely Bookmark, Tag, Tagging. I want to fetch all the bookmark on the basis of tag. I have written the sql queries but i don't know how to implement these in rails.
Attributes of the model are:
Bookmark: id , name
Tag : id , name
Tagging : bookmark_id , tag_id
SQL Queries that i have written for that is :
select * from Bookmark where id = (select bookmark_id from tagging where tag_id = (select * from tag where name= 'tag1'))
Aucun commentaire:
Enregistrer un commentaire