我需要的名稱與範圍或經營相結合...... 喜歡的東西:Rails3中:用結合範圍或
class Product < ActiveRecord::Base
belongs_to :client
scope :name_a, where("products.name = 'a'")
scope :client_b, joins(:client).where("clients.name = 'b'")
scope :name_a_or_b, name_a.or(client_b)
end
THX
天才!謝謝 – 2016-05-12 17:55:52