Changeset 2696
- Timestamp:
- 10/20/05 21:59:48 (3 years ago)
- Files:
-
- trunk/actionpack/CHANGELOG (modified) (1 diff)
- trunk/actionpack/lib/action_controller/base.rb (modified) (2 diffs)
- trunk/actionpack/lib/action_controller/session/active_record_store.rb (modified) (2 diffs)
- trunk/actionpack/test/controller/active_record_store_test.rb (modified) (6 diffs)
- trunk/actionpack/test/controller/base_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/CHANGELOG
r2688 r2696 1 1 *SVN* 2 3 * Expose the session model backing CGI::Session 2 4 3 5 * Abbreviate RAILS_ROOT in traces trunk/actionpack/lib/action_controller/base.rb
r2649 r2696 5 5 require 'action_controller/url_rewriter' 6 6 require 'drb' 7 require 'set' 7 8 8 9 module ActionController #:nodoc: … … 847 848 848 849 def self.action_methods 849 #puts "action method: #{public_instance_methods.inspect}" 850 @action_methods ||= (public_instance_methods - hidden_actions).inject({}) { |h, k| h[k] = true; h } 850 @action_methods ||= Set.new(public_instance_methods - hidden_actions) 851 851 end 852 852 trunk/actionpack/lib/action_controller/session/active_record_store.rb
r2663 r2696 6 6 class CGI 7 7 class Session 8 # Return this session's underlying Session model. Useful for the DB-backed session stores. 9 def model 10 @dbman.model rescue nil 11 end 12 13 # Proxy missing methods to the underlying Session model. 14 def method_missing(method, *args, &block) 15 if model then model.send(method, *args, &block) else super end 16 end 17 8 18 # A session store backed by an Active Record class. 9 19 # … … 278 288 end 279 289 290 # Access the underlying session model. 291 def model 292 @session 293 end 294 280 295 # Restore session state. The session model handles unmarshaling. 281 296 def restore trunk/actionpack/test/controller/active_record_store_test.rb
r2612 r2696 54 54 end 55 55 end 56 57 56 end 58 57 … … 74 73 end 75 74 75 def test_model_attribute 76 assert_kind_of CGI::Session::ActiveRecordStore::Session, @new_session.model 77 assert_equal @new_session.model.data, @new_session.data 78 end 79 76 80 def teardown 77 81 session_class.drop_table! … … 80 84 81 85 class ColumnLimitTest < Test::Unit::TestCase 82 83 86 def setup 84 87 @session_class = CGI::Session::ActiveRecordStore::Session … … 98 101 assert_raises(ActionController::SessionOverflowError) { s.save } 99 102 end 100 101 103 end 102 103 104 104 105 class DeprecatedActiveRecordStoreTest < ActiveRecordStoreTest … … 129 130 @session_class 130 131 end 132 133 def test_model_attribute 134 assert_kind_of CGI::Session::ActiveRecordStore::SqlBypass, @new_session.model 135 assert_equal @new_session.model.data, @new_session.data 136 end 131 137 end 132 138 … … 134 140 # End of safety net. 135 141 rescue Object => e 136 $stderr.puts "Skipping CGI::Session::ActiveRecordStore tests: #{e}" 142 $stderr.puts "Skipping CGI::Session::ActiveRecordStore tests: #{e}" 137 143 #$stderr.puts " #{e.backtrace.join("\n ")}" 138 144 end trunk/actionpack/test/controller/base_test.rb
r2277 r2696 68 68 69 69 def test_action_methods 70 @empty_controllers.each {|c| assert_equal({}, c.send(:action_methods), "#{c.class.controller_path} should be empty!")} 71 @non_empty_controllers.each {|c| assert_equal({"public_action"=>true}, c.send(:action_methods), "#{c.class.controller_path} should not be empty!")} 70 @empty_controllers.each do |c| 71 assert_equal Set.new, c.send(:action_methods), "#{c.class.controller_path} should be empty!" 72 end 73 @non_empty_controllers.each do |c| 74 assert_equal Set.new('public_action'), c.send(:action_methods), "#{c.class.controller_path} should not be empty!" 75 end 72 76 end 73 77 end