cirandas.net

ref: master

app/models/session.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
class Session < ActiveRecord::SessionStore::Session

  attr_accessible :session_id, :data

  # removed and redefined on super class
  def self.find_by_session_id session_id
    super
  end

  belongs_to :user

  before_save :copy_to_columns

  protected

  def copy_to_columns
    self.user_id = self.data['user']
  end

end