-
I have the following code, following the documentation, in order to try and create a profile after creating an account via Google login using Ideally, what I'd like to do is to create a Profile using the oauth data for First Name or Name field(s). # ==> Hooks
# Validate custom fields in the create account form.
# before_create_account do
# throw_error_status(422, "name", "must be present") if param("name").empty?
# end
omniauth_identity_insert_hash do
super().merge({
info: omniauth_info.to_json,
credentials: omniauth_credentials.to_json,
extra: omniauth_extra.to_json,
})
end
# Perform additional actions after the account is created.
after_create_account do
# binding.pry
Profile.create!(account_id: account_id)
end However, the I even tried the following in my Account model class Account < ApplicationRecord
include Rodauth::Rails.model
enum :status, unverified: 1, verified: 2, closed: 3
has_one :profile
# after_create :create_profile
after_create_commit :create_profile
private
def create_profile
# binding.pry
Profile.create!(account_id: account_id)
end
end The Wondering how I could figure out what's causing this behaviour and how to get around it. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Ok, I think I have this figured out after going through the I think the callbacks here are ignored entirely and deferred to Instead, I should do: after_omniauth_create_account do
Profile.create(account_id: account_id, bio: omniauth_info["description"], image_url: omniauth_info["image"])
end |
Beta Was this translation helpful? Give feedback.
Ok, I think I have this figured out after going through the
rodauth-omniauth
docs again.I think the callbacks here are ignored entirely and deferred to
rodauth-omniauth
'sInstead, I should do: