2014-11-06 14:46:59 +01:00
|
|
|
class User < ActiveRecord::Base
|
2014-11-23 21:12:31 +01:00
|
|
|
has_many :orders
|
2014-11-06 18:30:53 +01:00
|
|
|
|
2014-11-25 11:30:55 +01:00
|
|
|
validates :name, presence: true
|
|
|
|
validates :last_name, presence: true
|
|
|
|
validates :nickname, presence: true, uniqueness: true
|
2014-11-06 18:30:53 +01:00
|
|
|
|
2014-11-25 11:30:55 +01:00
|
|
|
def full_name
|
|
|
|
"#{name} #{last_name}"
|
2014-11-10 02:30:42 +01:00
|
|
|
end
|
2014-11-06 18:30:53 +01:00
|
|
|
|
2014-11-23 21:12:31 +01:00
|
|
|
has_secure_password
|
2014-11-06 14:46:59 +01:00
|
|
|
end
|