You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 28, 2021. It is now read-only.
There might a bug related to caching or database connection when the same table is used for authenticator and for the main app.
Assuming we have a class model Account with "email" and "encrypted_password" fields and we use a table "accounts" to store those. We also specify the the same table for the authenticator:
require'rails_helper'RSpec.describe"User log in",type: :featuredolet!(:account){Account.create!(email: 'test@example',password: 'secret')}scenario"user who has an account logs into the app"dovisit'/'fill_in'Username',with: account.emailfill_in'Password',with: 'secret'click_button'Login'expect(page).tohave_content'You are currently logged in as [email protected]'endend
Which is failing with "Incorrect username/passoword" message. What happens is that when the authenticator tries to fetch the record here:
it gets 0 results. Even though there is that account record in the table that was during the test. If I debug and do
::Account.count
# => 1
@model.count
# => 0
@model.create(email: "123", encrypted_password: "123")
# => ... (creates an actual record)
@model.count
# => 1
::Account.count
# => 2
# At this point If I do SQL queries through ::Account I get both records,
# but when doing SQL query from @model then I only get one record.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi,
There might a bug related to caching or database connection when the same table is used for authenticator and for the main app.
Assuming we have a class model
Account
with "email" and "encrypted_password" fields and we use a table "accounts" to store those. We also specify the the same table for the authenticator:Then there is a simple test:
Which is failing with "Incorrect username/passoword" message. What happens is that when the authenticator tries to fetch the record here:
casino-activerecord_authenticator/lib/casino/activerecord_authenticator.rb
Line 41 in 1227467
it gets 0 results. Even though there is that account record in the table that was during the test. If I debug and do
The text was updated successfully, but these errors were encountered: