Browse files

Deprecate pagination for Rails 1.2.4. Install the classic_pagination …

…plugin for forward compatibility, or move to the superior will_paginate plugin. References #8157.

git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/1-2-stable@6993 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 1f5a264 commit 9c0e4de88b92ace4ab6a156f631eecfc83770e85 @jeremy jeremy committed Jun 11, 2007
View
4 actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Deprecate pagination. Install the classic_pagination plugin for forward compatibility, or move to the superior will_paginate plugin. #8157 [Mislav Marohnic]
+
* Fix filtered parameter logging with nil parameter values. #8422 [choonkeat]
* Integration tests: alias xhr to xml_http_request and add a request_method argument instead of always using POST. #7124 [Nik Wakelin, Francois Beausoleil, Wizard]
@@ -465,7 +467,7 @@
* Avoid naming collision among compiled view methods. [Jeremy Kemper]
-* Fix CGI extensions when they expect string but get nil in Windows. Closes #5276 [mislav@nippur.irb.hr]
+* Fix CGI extensions when they expect string but get nil in Windows. Closes #5276 [Mislav Marohnic]
* Determine the correct template_root for deeply nested components. #2841 [s.brink@web.de]
View
8 actionpack/lib/action_controller/pagination.rb
@@ -1,7 +1,9 @@
module ActionController
# === Action Pack pagination for Active Record collections
#
- # DEPRECATION WARNING: Pagination will be separated into its own plugin with Rails 2.0.
+ # DEPRECATION WARNING: Pagination will be moved to a plugin in Rails 2.0.
+ # Install the classic_pagination plugin for forward compatibility:
+ # script/plugin install svn://errtheblog.com/svn/plugins/classic_pagination
#
# The Pagination module aids in the process of paging large collections of
# Active Record objects. It offers macro-style automatic fetching of your
@@ -130,6 +132,8 @@ def paginate(collection_id, options={})
paginator_and_collection_for(collection_id, options)
end
+ deprecate :paginate => 'Pagination is moving to a plugin in Rails 2.0: script/plugin install svn://errtheblog.com/svn/plugins/classic_pagination'
+
# These methods become class methods on any controller
module ClassMethods
# Creates a +before_filter+ which automatically paginates an Active
@@ -148,6 +152,8 @@ def paginate(collection_id, options={})
OPTIONS[self][collection_id] = options
end
end
+
+ deprecate :paginate => 'Pagination is moving to a plugin in Rails 2.0: script/plugin install svn://errtheblog.com/svn/plugins/classic_pagination'
end
def create_paginators_and_retrieve_collections #:nodoc:
View
9 actionpack/test/activerecord/pagination_test.rb
@@ -5,6 +5,8 @@ class PaginationTest < ActiveRecordTestCase
class PaginationController < ActionController::Base
self.template_root = "#{File.dirname(__FILE__)}/../fixtures/"
+
+ around_filter :silence_deprecation_warnings
def simple_paginate
@topic_pages, @topics = paginate(:topics)
@@ -67,6 +69,13 @@ def paginate_with_join_and_count
:count => "d.id")
render :nothing => true
end
+
+
+ def silence_deprecation_warnings
+ ActiveSupport::Deprecation.silence do
+ yield
+ end
+ end
def rescue_errors(e) raise e end
View
5 actionpack/test/controller/addresses_render_test.rb
@@ -39,7 +39,10 @@ def setup
end
def test_list
- get :list
+ # because pagination is deprecated
+ ActiveSupport::Deprecation.silence do
+ get :list
+ end
assert_equal "We only need to get this far!", @response.body.chomp
end
end
View
18 actionpack/test/controller/deprecation/deprecated_base_methods_test.rb
@@ -1,6 +1,12 @@
require File.dirname(__FILE__) + '/../../abstract_unit'
class DeprecatedBaseMethodsTest < Test::Unit::TestCase
+ # ActiveRecord model mock to test pagination deprecation
+ class DummyModel
+ def self.find(*args) [] end
+ def self.count(*args) 0 end
+ end
+
class Target < ActionController::Base
def deprecated_symbol_parameter_to_url_for
redirect_to(url_for(:home_url, "superstars"))
@@ -18,6 +24,11 @@ def raises_name_error
this_method_doesnt_exist
end
+ def pagination
+ paginate :dummy_models, :class_name => 'DeprecatedBaseMethodsTest::DummyModel'
+ render :nothing => true
+ end
+
def rescue_action(e) raise e end
end
@@ -27,6 +38,7 @@ def setup
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
@controller = Target.new
+ @controller.logger = Logger.new(nil) unless @controller.logger
end
def test_deprecated_symbol_parameter_to_url_for
@@ -57,4 +69,10 @@ def test_assertion_failed_error_silences_deprecation_warnings
error = Test::Unit::Error.new('testing ur doodz', e)
assert_not_deprecated { error.message }
end
+
+ def test_pagination_deprecation
+ assert_deprecated('svn://errtheblog.com/svn/plugins/classic_pagination') do
+ get :pagination
+ end
+ end
end

0 comments on commit 9c0e4de

Please sign in to comment.