0
我得到這個警告條件在軌貶值的使用範圍塊
DEPRECATION WARNING: The following options in your Product.has_many :recommended_users declaration are deprecated: :conditions. Please use a scope block instead. For example, the following:
has_many :spam_comments, conditions: { spam: true }, class_name: 'Comment'
should be rewritten as the following:
has_many :spam_comments, -> { where spam: true }, class_name: 'Comment'
我試圖重寫使用新範圍塊我的代碼,但沒有成功:
has_many :current_products, :class_name => "Product", :through => :associations, :source => :product, :conditions => ["associations.category = ?", 1]
有人可以幫助我?
請參閱http://stackoverflow.com/questions/16569994/deprecation-warning-when-using-has-many-through-uniq-in-rails-4?rq=1 – Pavan