为什么根据文档的代码有效? http://api.rubyonrails.org/classes/ActiveRecord/Scoping/Named/ClassMethods.html
class Article < ActiveRecord::Base
scope :featured, where(:featured => true)
def self.titles
map(&:title)
end
end
Article.featured.titles
在我的控制台中得到:
NoMethodError: undefined method `map' for #<Class:0xb70bfb0>