Class: ActiveModel::Password

Inherits:
Object
  • Object
show all
Includes:
Model
Defined in:
lib/active_model/password.rb,
lib/active_model/password/version.rb

Constant Summary collapse

VERSION =
"1.0.0"

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#passwordObject

Returns the value of attribute password.



8
9
10
# File 'lib/active_model/password.rb', line 8

def password
  @password
end

#userObject

Returns the value of attribute user.



8
9
10
# File 'lib/active_model/password.rb', line 8

def user
  @user
end

Instance Method Details

#persisted?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/active_model/password.rb', line 13

def persisted?
  user.present? and user.persisted?
end

#saveObject



17
18
19
20
21
22
# File 'lib/active_model/password.rb', line 17

def save
  return false unless valid?
  user.password = password
  user.password_confirmation = password_confirmation
  user.save
end