How to disable search queries when searching a user in a database
Does anyone know how to disable search queries when (authenticating or verifying) a user on every request?
Let's say I have this scoped user model
class User < ActiveRecord::Base
default_scope where(group_id: 1)
end
I already got unscope on authentication by overriding the method find_for_authentication
:
def self.find_for_authentication(conditions)
User.unscoped { super }
end
But when I go to any page that has a filter :authenticate_user!
, select logs from user because it uses scope. I also tried to disable the method active_for_authentication?
, but it didn't work.
Does anyone know where Devise is displaying the current user from the database in every request for a page that is filtered :authenticate_user!
?
I am using Rails 3.2.1 and Devise 2.0.
source to share