summaryrefslogtreecommitdiff
path: root/app/models/user.rb
blob: 75c66c0cf68ee0f3ef27c114b7f9d5db25e29ba3 (plain)
1
2
3
4
5
6
7
8
9
10
11
class User < ActiveRecord::Base
  has_many :sessions
  has_many :videos
  validates :email, email: true

  has_secure_password

  def login(password)
    sessions.build if authenticate(password)
  end
end