【发布时间】:2013-12-01 01:55:59
【问题描述】:
谁能告诉我在 Rails 4 中执行以下行的等效方法是什么?
has_many :friends, :through => :friendships, :conditions => "status = 'accepted'", :order => :first_name
我尝试了以下方法:
has_many :friends, -> { where status: 'accepted' }, :through => :friendships , :order => :first_name
但我收到以下错误:
Invalid mix of scope block and deprecated finder options on ActiveRecord association: User.has_many :friends
【问题讨论】:
-
呃……你能把整个文件贴出来吗?我以前从未见过这个错误。
-
呃,没关系,我想我知道出了什么问题,会更新......
标签: ruby-on-rails-4