Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @specific_feeling_posts = @posts.feeling.where(:feeling => "happy")
- class Post < ActiveRecord::Base
- has_many :feelingships
- has_many :feelings, :through => :feelingships
- belongs_to :user
- end
- class Feeling < ActiveRecord::Base
- has_many :feelingships
- has_many :posts, :through => :feelingships
- end
- class Feelingship < ActiveRecord::Base
- belongs_to :post
- belongs_to :feeling
- end
- @happy_posts = Post.joins(:feelings).where("feelings.title = ?", "happy")
- @specific_feelings_post=Post.join(:feelings).where("feelings.title= ?","specific_feeling")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement