Closed jaahoo closed 2 years ago
Thanks for reporting, this came up in a discussion as well, but I forgot to follow through. Could you try replacing the join with the subquery shown in the linked comment?
By the way, why was the id
primary key removed from the table in the wiki page? Did it cause problems?
Yes I wrote it in revision message: "Hi, with id on account_types table I have 'PG::AmbiguousColumn: ERROR: column reference "id" is ambiguous' error in account_ds method. After I set id to false everything works. I tried to update the join query to works but I couldn't make it."
But with that your comment from that discussion I think the id could stay =) (it will fix it)
Only one small thing, you have
super.where(id: db[:account_types].where(type: "admin").select(:id))
but that id is id of account_types table, so I change it to
super.where(id: db[:account_types].where(type: "admin").select(:account_id))
This works with my test app. If you think it's ok I will update the wiki.
Yes, thanks for the catch, the updated subquery looks good. Feel free to update the wiki 👍🏻
Problem solved The solution has been added to the wiki https://github.com/janko/rodauth-rails/wiki/Account-Types
Gemfile
I have set RodauthAdmin
and type table
After I create admin account
RodauthApp.rodauth(:admin).create_account(login: "user@example.com", password: "secret")
I got e-mail with verify link and after clicking on verification link an error occursNeed multiple FROM tables if updating/deleting a dataset with JOINs
And in console:
If I remove
auth_class_eval
the verification will pass withou error