Sha256: c769e8a4ced85368c60d9ccbc50f5af5c698873c900718bc30dd6e58873bd060

Contents?: true

Size: 734 Bytes

Versions: 5

Compression:

Stored size: 734 Bytes

Contents

require 'shared_user'

class User
  include MongoMapper::Document

  key :username, String
  key :facebook_token, String
  timestamps!

  include SharedUser
  include Shim

  unless DEVISE_ORM == :mongo_mapper_active_model
    before_validation :update_password_confirmation

    # DM's validates_confirmation_of requires the confirmation field to be present,
    # while ActiveModel by default skips the confirmation test if the confirmation
    # value is nil. This test takes advantage of AM's behavior, so just add the
    # :password_confirmation value.
    def update_password_confirmation
      if self.password && self.password_confirmation.nil?
        self.password_confirmation = self.password
      end
    end
  end 
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mm-devise-1.1.10 test/rails_app/app/mongo_mapper/user.rb
mm-devise-1.1.8 test/rails_app/app/mongo_mapper/user.rb
mm-devise-1.1.7 test/rails_app/app/mongo_mapper/user.rb
mm-devise-1.1.6 test/rails_app/app/mongo_mapper/user.rb
mm-devise-1.1.1 test/rails_app/app/mongo_mapper/user.rb