While using named_scope in Rails 3.0.3
class Project < ActiveRecord::Base
scope :completed,:conditions=>"finish = true"
end
class Project < ActiveRecord::Baseyou will get DEPRECATION WARNING.
named_scope :completed,:conditions=>"finish = true"
end
DEPRECATION WARNING: Base.named_scope has been deprecated, please use Base.scope instead. (called from C:/projects/myapp/app/models/project.rb:2)To fix this use scope instead of named_scope. Your new code will be:
class Project < ActiveRecord::Base
scope :completed,:conditions=>"finish = true"
end
No comments:
Post a Comment