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-laboratory-7.9.0 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-520f859ca8af/app/models/concerns/with_profile.rb
mumuki-domain-7.9.0 app/models/concerns/with_profile.rb
mumuki-domain-7.7.3 app/models/concerns/with_profile.rb
mumuki-domain-7.8.1 app/models/concerns/with_profile.rb
mumuki-domain-7.8.0 app/models/concerns/with_profile.rb
mumuki-domain-7.7.2 app/models/concerns/with_profile.rb
mumuki-domain-7.7.1 app/models/concerns/with_profile.rb
mumuki-laboratory-7.7.1 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-cb7a9018bb94/app/models/concerns/with_profile.rb
mumuki-laboratory-7.7.0 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-cb7a9018bb94/app/models/concerns/with_profile.rb
mumuki-domain-7.7.0 app/models/concerns/with_profile.rb
mumuki-domain-7.6.1 app/models/concerns/with_profile.rb
mumuki-domain-7.6.0 app/models/concerns/with_profile.rb
mumuki-laboratory-7.5.2 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-ad16a5930cec/app/models/concerns/with_profile.rb
mumuki-laboratory-7.5.1 vendor/bundle/ruby/2.3.0/bundler/gems/mumuki-domain-a059418e5fd8/app/models/concerns/with_profile.rb
mumuki-domain-7.5.1 app/models/concerns/with_profile.rb
mumuki-laboratory-7.5.0 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-acb12583b793/app/models/concerns/with_profile.rb
mumuki-domain-7.5.0 app/models/concerns/with_profile.rb
mumuki-domain-7.4.1 app/models/concerns/with_profile.rb
mumuki-domain-7.4.0 app/models/concerns/with_profile.rb
mumuki-domain-7.3.2 app/models/concerns/with_profile.rb