Closed gaiabeatrice closed 2 years ago
Yeah, you can rename them. This sounds like a config issue. Do you have user: MyApp.Admin.DashboardAdmin
in your Pow config?
Thank you, this is one of the best libraries out there
Thanks for your kind words!
Good catch, I was missing a word in the user config.
I found in a page that I have to add user_identity_context
to the pow_assent config and I did
config :genesis, :pow_assent,
providers: [
# list of providers
],
user_identity_context: MyApp.Admin.DashboardAdminIdentity
But I get this error The `:user` configuration option doesn't have a `:user_identities` association.
It is not very clear where the user identities association should be defined in this case.
Oh right, you need to change the association name from :dashboard_admin_identities
to :user_identities
:
defmodule MyApp.Admin.DashboardAdmin do
use Ecto.Schema
use Pow.Ecto.Schema
schema "dashboard_admins" do
has_many :user_identities,
MyApp.Admin.DashboardAdminIdentity,
on_delete: :delete_all,
foreign_key: :user_id
pow_user_fields()
timestamps()
end
end
Then it should be working!
The :user_identity_context
is only used for set up custom context module: https://hexdocs.pm/pow_assent/PowAssent.Ecto.UserIdentities.Context.html#content
Hello, I am working on a project that already has a user table and I would like to have different namings for the
users
anduser_identities
tables.I thought it was possible because the mix tasks for that accept a new name for the table and the schema modules.
those are the tasks I use:
mix pow.install Admin.DashboardAdmin dashboard_admins
mix pow_assent.install Admin.DashboardAdminIdentity dashboard_admin_identities
But it is giving me a lot of problems
** (UndefinedFunctionError) function MyApp.DashboardAdmin.__schema__/2 is undefined (module MyApp.DashboardAdmin is not available)
and** (UndefinedFunctionError) function MyApp.DashboardAdmin.user_identity_changeset/4 is undefined or private
.So my question is: is it possible to actually have different schema and table names without a lot of issues? Is there a guide for it somewhere that can help with this?
Thank you, this is one of the best libraries out there