0
您可以使用tagged_with
找到標記的對象。rails:如何基於acts_as_taggable_on關聯標籤進行查詢?
class User < ActiveRecord::Base
acts_as_taggable_on :tags, :skills
scope :by_join_date, order("created_at DESC")
end
User.tagged_with("awesome").by_join_date
但你如何找到標記對象的關聯?
class UserAccount < ActiveRecord::Base
belongs_to :user
end
UserAccount.joins(:user)...???