Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActiveRecord::RecordNotFound (Couldn't find User with 'id'=xxx): #239

Open
alhafoudh opened this issue Dec 8, 2023 · 3 comments
Open

ActiveRecord::RecordNotFound (Couldn't find User with 'id'=xxx): #239

alhafoudh opened this issue Dec 8, 2023 · 3 comments

Comments

@alhafoudh
Copy link
Collaborator

Ked developujem, preseedovavam databazu, pri prihlaseni sa rails pokusi najst uzivatela zo sessionu z predosleho obsahu databazy.

ActiveRecord::RecordNotFound (Couldn't find User with 'id'=2):

app/controllers/concerns/authentication.rb:47:in `load_current_user'
  def load_current_user
    Current.user = User.find(session[:user_id]) if session[:user_id]
    Current.tenant = Tenant.find(session[:tenant_id]) if session[:tenant_id]
    Current.box = Current.tenant.boxes.find(session[:box_id]) if session[:box_id]
  end

Navrhujem dat tam User.find_by(id: session[:user_id]) namiesto User.find(session[:user_id]).
Co si o tom myslite?

@jsuchal
Copy link
Member

jsuchal commented Dec 10, 2023

No ale spravanie by malo byt potom logout a zrusenie vsetkeho v session nie?

@alhafoudh
Copy link
Collaborator Author

Ano, tak by som ocakaval.

@jsuchal
Copy link
Member

jsuchal commented Dec 11, 2023

@alhafoudh za mna dobre. Mne sa zase dialo to, ze sem tam sme zrusili box a potom som sa uz nevedel prihlasit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants