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

Changeset 4664

Show
Ignore:
Timestamp:
08/05/06 01:56:58 (2 years ago)
Author:
bitsweat
Message:

Make controller_path available as an instance method. Closes #5724.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/CHANGELOG

    r4660 r4664  
    11*SVN* 
     2 
     3* Make controller_path available as an instance method.  #5724 [jmckible@gmail.com] 
    24 
    35* Update query parser to support adjacent hashes. [Nicholas Seckar] 
  • trunk/actionpack/lib/action_controller/base.rb

    r4637 r4664  
    499499        self.class.controller_name 
    500500      end 
     501       
     502      # Converts the class name from something like "OneModule::TwoModule::NeatController" to "one_module/two_module/neat". 
     503      def controller_path 
     504        self.class.controller_path 
     505      end 
    501506 
    502507      def session_enabled? 
  • trunk/actionpack/test/controller/base_test.rb

    r4656 r4664  
    3737  def test_controller_path 
    3838    assert_equal 'empty', EmptyController.controller_path 
     39    assert_equal EmptyController.controller_path, EmptyController.new.controller_path 
    3940    assert_equal 'submodule/contained_empty', Submodule::ContainedEmptyController.controller_path 
     41    assert_equal Submodule::ContainedEmptyController.controller_path, Submodule::ContainedEmptyController.new.controller_path 
    4042  end 
    4143  def test_controller_name 
     
    5759  def test_action_methods 
    5860    @empty_controllers.each do |c| 
    59       assert_equal Set.new, c.send(:action_methods), "#{c.class.controller_path} should be empty!" 
     61      assert_equal Set.new, c.send(:action_methods), "#{c.controller_path} should be empty!" 
    6062    end 
    6163    @non_empty_controllers.each do |c| 
    62       assert_equal Set.new('public_action'), c.send(:action_methods), "#{c.class.controller_path} should not be empty!" 
     64      assert_equal Set.new('public_action'), c.send(:action_methods), "#{c.controller_path} should not be empty!" 
    6365    end 
    6466  end