Sha256: ace18896b1268607c7ba3e2291ed84a315eb3b094efaa84abad729ea5f96e52a

Contents?: true

Size: 286 Bytes

Versions: 160

Compression:

Stored size: 286 Bytes

Contents

module WithProfile
  extend ActiveSupport::Concern

  module ClassMethods
    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
  end
end

Version data entries

160 entries across 160 versions & 2 rubygems

Version Path
mumuki-domain-7.3.1 app/models/concerns/with_profile.rb
mumuki-domain-7.2.3 app/models/concerns/with_profile.rb
mumuki-domain-7.3.0 app/models/concerns/with_profile.rb
mumuki-domain-7.2.2 app/models/concerns/with_profile.rb
mumuki-domain-7.2.1 app/models/concerns/with_profile.rb
mumuki-domain-7.2.0 app/models/concerns/with_profile.rb
mumuki-laboratory-7.1.0 vendor/bundle/ruby/2.3.0/bundler/gems/mumuki-domain-925adf85cca8/app/models/concerns/with_profile.rb
mumuki-domain-7.1.0 app/models/concerns/with_profile.rb
mumuki-laboratory-7.0.12 vendor/bundle/ruby/2.3.0/bundler/gems/mumuki-domain-74da3d4af98c/app/models/concerns/with_profile.rb
mumuki-domain-7.0.6 app/models/concerns/with_profile.rb
mumuki-domain-7.0.5 app/models/concerns/with_profile.rb
mumuki-domain-7.0.4 app/models/concerns/with_profile.rb
mumuki-domain-7.0.3 app/models/concerns/with_profile.rb
mumuki-laboratory-7.0.11 vendor/bundle/ruby/2.3.0/bundler/gems/mumuki-domain-f892f79c60f0/app/models/concerns/with_profile.rb
mumuki-domain-7.0.2 app/models/concerns/with_profile.rb
mumuki-domain-7.0.1 app/models/concerns/with_profile.rb
mumuki-domain-7.0.0 app/models/concerns/with_profile.rb
mumuki-domain-6.7.2 app/models/concerns/with_profile.rb
mumuki-domain-6.7.1 app/models/concerns/with_profile.rb
mumuki-domain-6.7.0 app/models/concerns/with_profile.rb