diff options
-rw-r--r-- | actionpack/CHANGELOG | 2 | ||||
-rw-r--r-- | actionpack/lib/action_controller/scaffolding.rb | 2 | ||||
-rw-r--r-- | actionpack/test/controller/addresses_render_test.rb | 45 | ||||
-rw-r--r-- | actionpack/test/fixtures/addresses/list.rhtml | 1 |
4 files changed, 49 insertions, 1 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index d968acd2f3..b965822efc 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Fixed double-singularization on scaffolded pagination call (Address would be turned into Addres) #1216, #1404 [nilsga] + * Removed the require hack used by functional testing to work around an earlier bug in rake. * Allow distance_of_time_in_words to work with any value that responds to #to_time (like dates) #969 diff --git a/actionpack/lib/action_controller/scaffolding.rb b/actionpack/lib/action_controller/scaffolding.rb index 3435ce5108..8108bf6956 100644 --- a/actionpack/lib/action_controller/scaffolding.rb +++ b/actionpack/lib/action_controller/scaffolding.rb @@ -99,7 +99,7 @@ module ActionController module_eval <<-"end_eval", __FILE__, __LINE__ def list#{suffix} - @#{singular_name}_pages, @#{plural_name} = paginate :#{singular_name}, :per_page => 10 + @#{singular_name}_pages, @#{plural_name} = paginate :#{plural_name}, :per_page => 10 render#{suffix}_scaffold "list#{suffix}" end diff --git a/actionpack/test/controller/addresses_render_test.rb b/actionpack/test/controller/addresses_render_test.rb new file mode 100644 index 0000000000..a7b3e3a323 --- /dev/null +++ b/actionpack/test/controller/addresses_render_test.rb @@ -0,0 +1,45 @@ +require File.dirname(__FILE__) + '/../abstract_unit' + +class Address + + def Address.count(conditions = nil, join = nil) + nil + end + + def Address.find_all(arg1, arg2, arg3, arg4) + [] + end +end + +class AddressesTestController < ActionController::Base + + scaffold :address + + def self.controller_name; "addresses"; end + def self.controller_path; "addresses"; end + +end + +AddressesTestController.template_root = File.dirname(__FILE__) + "/../fixtures/" + +class AddressesTest < Test::Unit::TestCase + def setup + @controller = AddressesTestController.new + + # enable a logger so that (e.g.) the benchmarking stuff runs, so we can get + # a more accurate simulation of what happens in "real life". + @controller.logger = Logger.new(nil) + + @request = ActionController::TestRequest.new + @response = ActionController::TestResponse.new + + @request.host = "www.nextangle.com" + end + + def test_list + get :list + assert_equal "We only need to get this far!", @response.body.chomp + end + + +end diff --git a/actionpack/test/fixtures/addresses/list.rhtml b/actionpack/test/fixtures/addresses/list.rhtml new file mode 100644 index 0000000000..c75e01eece --- /dev/null +++ b/actionpack/test/fixtures/addresses/list.rhtml @@ -0,0 +1 @@ +We only need to get this far! |