-
-
Notifications
You must be signed in to change notification settings - Fork 158
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
Embedded association with user ? #308
Comments
Yeah, no need to override controllers. You just have to customize the changeset and add custom templates with the custom fields e.g. using If it should only update during registration then this might help you: #276 (comment) |
@danschultzer thank you so much for the quick answer ! |
If it’s an embedded schema then you won’t have to preload it? |
Oh reading your question again, I realize you probably didn’t mean embedded schema. So yes, you can use a custom context, but this should only be necessary for update of existing users. |
@danschultzer im actually using the invitation extension with the register disable. |
This would work: defmodule MyApp.Users do
use Pow.Ecto.Context,
repo: MyApp.Repo,
user: MyApp.Users.User
@impl true
def get_by(clauses) do
clauses
|> pow_get_by()
|> preload_profile()
end
defp preload_profile(nil), do: nil
defp preload_profile(user) do
MyApp.Repo.preload(user, :profile)
end
end But the above will preload the profile anywhere the Here's an example of how you can override default controller actions with a custom controller for |
I assume that the above worked. I'll close the issue. |
Hi, i need to create a profile that is a has_one association with the user.
This needs to be create in the register form (embedded) alongside the user.
Is there a standard way to do this in pow or do i need to override the controllers ?
The text was updated successfully, but these errors were encountered: