Module: WithProfile::ClassMethods

Defined in:
app/models/concerns/with_profile.rb

Instance Method Summary collapse

Instance Method Details

#for_profile(profile) ⇒ Object



5
6
7
8
9
10
# File 'app/models/concerns/with_profile.rb', line 5

def for_profile(profile)
  where(uid: profile.uid).first_or_initialize.tap do |user|
    user.assign_attributes(profile.to_h.compact)
    user.save_and_notify_changes!
  end
end