knock
knock copied to clipboard
Everytime, every request I have: "User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]"
I'm using:
class GoodsController < ApplicationController
before_action :authenticate_user
....
so now I have everytime, every request in my log:
User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
Why? Everytime a query? Is token valid just with secret_key?
I wonder the same. +1
If I understand it correctly perhaps Knock calls the current_user
method it defines to ensure the user still exists?
I am facing the same issue. It executes following query for every request
SELECT "users".* FROM "users" WHERE "users"."email" = $1 LIMIT $2
We have separate front / back end application. We are integrating auth0 in our application.
For back authentication we are using knock gem.
I have added following code in my user.rb
def self.from_token_payload(payload)
User.find_by_email(payload['email'])
# or create new one
end
Every request comes to this method and each time its validating user.
Is there any configuration like it will call this method only once?