summaryrefslogtreecommitdiff
path: root/users/app/models/session.rb
blob: a9fdb1bbf1f9cf0c3071142648cb1327e6bc18fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
class Session < SRP::Session
  include ActiveModel::Validations

  attr_accessor :login

  validates :login,
    :presence => true,
    :format => { :with => /\A[A-Za-z\d_]+\z/,
      :message => "Only letters, digits and _ allowed" }

  def initialize(user = nil, aa = nil)
    super(user, aa) if user
  end

  def persisted?
    false
  end

  def new_record?
    true
  end

  def to_model
    self
  end

  def to_key
    [object_id]
  end

  def to_param
    nil
  end
end