我在使用范围在rails中正常工作时遇到了一些麻烦.
我的模特:
class User < ActiveRecord::Base default_scope :conditions => 'users.deleted_at IS NULL' class Feed < ActiveRecord::Base belongs_to :user,:foreign_key => :author_id
当我打电话给以下人时:
Feeds = Feed.includes(:user)
我想为用户跳过default_scope.所以我试过了:
Feeds = Feed.unscoped.includes(:user)