在控制台中,当我运行“Zip.code(74738).users.count”行时,我收到以下错误:
DEPRECATION WARNING: Relation#first with finder options is deprecated. Please build a scope and then call #first on it instead. (called from code at /Users/lexi87/DATING/app/models/zip.rb:6)
Zip Load (12.6ms) SELECT `zips`.* FROM `zips` WHERE `zips`.`code` = 30052 ORDER BY `zips`.`id` ASC LIMIT 1
我已经尝试了一些事情,但仍然继续收到警告。这是它指向的原始代码:
def self.code(code)
first(:conditions => {:code => code})
end