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-5.5.0 app/models/concerns/with_profile.rb
mumuki-laboratory-5.4.0 app/models/concerns/with_profile.rb
mumuki-laboratory-5.3.0 app/models/concerns/with_profile.rb
mumuki-laboratory-5.2.1 app/models/concerns/with_profile.rb
mumuki-laboratory-5.2.0 app/models/concerns/with_profile.rb
mumuki-laboratory-5.1.1 app/models/concerns/with_profile.rb
mumuki-laboratory-5.1.0 app/models/concerns/with_profile.rb
mumuki-laboratory-5.0.12 app/models/concerns/with_profile.rb
mumuki-laboratory-5.0.11 app/models/concerns/with_profile.rb
mumuki-laboratory-5.0.10 app/models/concerns/with_profile.rb
mumuki-laboratory-5.0.9 app/models/concerns/with_profile.rb
mumuki-laboratory-5.0.8 app/models/concerns/with_profile.rb
mumuki-laboratory-5.0.7 app/models/concerns/with_profile.rb
mumuki-laboratory-5.0.6 app/models/concerns/with_profile.rb
mumuki-laboratory-5.0.5 app/models/concerns/with_profile.rb
mumuki-laboratory-5.0.4 app/models/concerns/with_profile.rb
mumuki-laboratory-5.0.3 app/models/concerns/with_profile.rb
mumuki-laboratory-5.0.2 app/models/concerns/with_profile.rb
mumuki-laboratory-5.0.1 app/models/concerns/with_profile.rb
mumuki-laboratory-5.0.0 app/models/concerns/with_profile.rb