Class: User
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- User
- Defined in:
- app/models/user.rb
Constant Summary
- PWORD_DIGST =
:password_digest is some type of bcrypt salt??
"pword"
Class Method Summary (collapse)
- + (Object) find_by_credentials(email, password)
- + (Object) new_user(password, email, first_name, last_name)
Instance Method Summary (collapse)
Class Method Details
+ (Object) find_by_credentials(email, password)
9 10 11 |
# File 'app/models/user.rb', line 9 def User.find_by_credentials(email, password) return User.find_by email: email, password: password end |
+ (Object) new_user(password, email, first_name, last_name)
13 14 15 16 17 18 |
# File 'app/models/user.rb', line 13 def User.new_user(password, email, first_name, last_name) unless User.exists?(:email => email) return User.new(password: password, email: email, password_digest: PWORD_DIGST, first_name: first_name, last_name: last_name, approved: false) end end |
Instance Method Details
- (Object) as_json(options = {})
20 21 22 |
# File 'app/models/user.rb', line 20 def as_json(={}) super(:except => [:created_at, :updated_at, :password, :password_digest]) end |