tap/app/models/user.rb
2014-12-04 19:50:02 +01:00

27 lines
602 B
Ruby

# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# name :string(255)
# last_name :string(255)
# balance :integer default(0)
# nickname :string(255)
# password_digest :string(255)
# created_at :datetime
# updated_at :datetime
#
class User < ActiveRecord::Base
has_many :orders
validates :name, presence: true
validates :last_name, presence: true
validates :nickname, presence: true, uniqueness: true
def full_name
"#{name} #{last_name}"
end
has_secure_password
end