Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 517

Show
Ignore:
Timestamp:
02/06/05 18:29:11 (4 years ago)
Author:
david
Message:

Minor refactoring to prettify

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_controller/session/active_record_store.rb

    r4 r517  
    3030      # This session's ActiveRecord database row will be created if it does not exist, or opened if it does. 
    3131      def initialize(session, option=nil) 
    32         @session = Session.find_first(["sessid = '%s'", session.session_id]) 
    33         if @session 
    34           @data = @session.data 
    35         else 
    36           @session = Session.new("sessid" => session.session_id, "data" => {}) 
    37         end 
     32        @session = Session.find_by_sessid(session.session_id) || Session.new("sessid" => session.session_id, "data" => {}) 
     33        @data    = @session.data 
    3834      end 
    3935 
     
    6157      def update 
    6258        return unless @session 
    63         @session.data = @data 
    64         @session.save 
     59        @session.update_attribute "data", @data 
    6560      end 
    6661    end #ActiveRecordStore