diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-02-06 18:29:11 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-02-06 18:29:11 +0000 |
commit | 838c5a3d82367977d13ced01f9e28c22ccff32ef (patch) | |
tree | 42ca863f7a145ea997e2d98666c957b95a6e40a9 /actionpack/lib | |
parent | ac8ebc19be69c907798e5146471aa0234396eb46 (diff) | |
download | rails-838c5a3d82367977d13ced01f9e28c22ccff32ef.tar.gz rails-838c5a3d82367977d13ced01f9e28c22ccff32ef.tar.bz2 rails-838c5a3d82367977d13ced01f9e28c22ccff32ef.zip |
Minor refactoring to prettify
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@517 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/session/active_record_store.rb | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/actionpack/lib/action_controller/session/active_record_store.rb b/actionpack/lib/action_controller/session/active_record_store.rb index c144f62e35..353292b87c 100644 --- a/actionpack/lib/action_controller/session/active_record_store.rb +++ b/actionpack/lib/action_controller/session/active_record_store.rb @@ -29,12 +29,8 @@ class CGI # # This session's ActiveRecord database row will be created if it does not exist, or opened if it does. def initialize(session, option=nil) - @session = Session.find_first(["sessid = '%s'", session.session_id]) - if @session - @data = @session.data - else - @session = Session.new("sessid" => session.session_id, "data" => {}) - end + @session = Session.find_by_sessid(session.session_id) || Session.new("sessid" => session.session_id, "data" => {}) + @data = @session.data end # Update and close the session's ActiveRecord object. @@ -60,8 +56,7 @@ class CGI # Save session state in the session's ActiveRecord object. def update return unless @session - @session.data = @data - @session.save + @session.update_attribute "data", @data end end #ActiveRecordStore end #Session |