In short, passing options hash containing :conditions, :include, :joins, :limit, : offset, : order, :select, :readonly, :group, :having, :from, :lock to any of the ActiveRecord provided class methods, is now deprecated.
简单的说,把:conditions, :include, :joins, :limit, : offset, : order, :select, :readonly, :group, :having, :from, :lock这些选项hash传递给ActiveRecord的任何一个类方法的做法已经不建议使用了。
Going into details, currently ActiveRecord provides the following finder methods :
详细点说,当前版本的ActiveRecord提供了以下finder方法:
* find(id_or_array_of_ids, options)
* find(:first, options)
* find(:all, options)
* first(options)
* all(options)
* update_all(updates, conditions, options)
And the following calculation methods :
和以下统计方法:
* count(column, options)
* average(column, options)
* minimum(column, options)
* maximum(column, options)
* sum(column, options)
* calculate(operation, column, options)
Starting with Rails 3, supplying any option to the methods above will be deprecated. Support for supplying options will be removed from Rails 3.2. Moreover, find(:first) and find(:all) ( without any options ) are also being deprecated in favour of first and all. A tiny little exception here is that count() will still accept a :distinct option.
从Rails3开始,不建议给以上的方法传递任何选项,并且将在Rails3.2中移除对这种方式的支持。同时,find(:first)和find(:all)(不带任何其它选项)也不建议使用,而改用first、all方法。但是还有个特例:count()方法将仍然接收:distinct选项。
简单的说,把:conditions, :include, :joins, :limit, : offset, : order, :select, :readonly, :group, :having, :from, :lock这些选项hash传递给ActiveRecord的任何一个类方法的做法已经不建议使用了。
Going into details, currently ActiveRecord provides the following finder methods :
详细点说,当前版本的ActiveRecord提供了以下finder方法:
* find(id_or_array_of_ids, options)
* find(:first, options)
* find(:all, options)
* first(options)
* all(options)
* update_all(updates, conditions, options)
And the following calculation methods :
和以下统计方法:
* count(column, options)
* average(column, options)
* minimum(column, options)
* maximum(column, options)
* sum(column, options)
* calculate(operation, column, options)
Starting with Rails 3, supplying any option to the methods above will be deprecated. Support for supplying options will be removed from Rails 3.2. Moreover, find(:first) and find(:all) ( without any options ) are also being deprecated in favour of first and all. A tiny little exception here is that count() will still accept a :distinct option.
从Rails3开始,不建议给以上的方法传递任何选项,并且将在Rails3.2中移除对这种方式的支持。同时,find(:first)和find(:all)(不带任何其它选项)也不建议使用,而改用first、all方法。但是还有个特例:count()方法将仍然接收:distinct选项。