ããã°ãã¹ããè¤æ°ã«ãã´ãªãæã¦ãã¨ããå ´åã§ã ããè¨äºã¨åãã«ãã´ãªãæã¤è¨äºãæ¢ãã¨ãããã¨ãããããã #Postã¢ãã« class Post < ActiveRecord::Base has_and_belongs_to_many :categories end #交差ãã¼ãã« class CategoriesPost < ActiveRecord::Base end #Categoryã¢ãã« class Category < ActiveRecord::Base has_and_belongs_to_many :posts end post = Post.first categories = Category.joins(:posts).where("posts.id = ?", post.id).select("categories.id") category_ids = c
{{#tags}}- {{label}}
{{/tags}}