Sha256: 6fa6a7115b3452d1c564aef9a1290d0642bad5e8434e7ec7b9425fb7c4b29458

Contents?: true

Size: 816 Bytes

Versions: 1

Compression:

Stored size: 816 Bytes

Contents

require 'shared_user'

class User
  include DataMapper::Resource

  property :id, Serial
  property :username, String
  property :facebook_token, String
  property :confirmation_token, String, :writer => :private
  timestamps :at

  include SharedUser
  include Shim

  if VALIDATION_LIB == 'dm-validations'
    before :valid?, :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

1 entries across 1 versions & 1 rubygems

Version Path
dm-devise-1.5.0.beta test/rails_app/app/data_mapper/user.rb