Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make WillPaginate::Deprecation.warn output the caller

  • Loading branch information...
commit 62b9f6c2114ea96a4b93be7bed766b7dc274a275 1 parent a6d5b07
@dejan dejan authored committed
Showing with 4 additions and 9 deletions.
  1. +1 −5 lib/will_paginate.rb
  2. +3 −4 lib/will_paginate/view_helpers.rb
View
6 lib/will_paginate.rb
@@ -68,11 +68,7 @@ module Deprecation # :nodoc:
def self.warn(message, callstack = caller)
message = 'WillPaginate: ' + message.strip.gsub(/\s+/, ' ')
- behavior.call(message, callstack) if behavior && !silenced?
- end
-
- def self.silenced?
- ActiveSupport::Deprecation.silenced?
+ ActiveSupport::Deprecation.warn(message, callstack)
end
end
end
View
7 lib/will_paginate/view_helpers.rb
@@ -99,7 +99,7 @@ def will_paginate(collection = nil, options = {})
options = options.symbolize_keys.reverse_merge WillPaginate::ViewHelpers.pagination_options
if options[:prev_label]
- WillPaginate::Deprecation::warn(":prev_label view parameter is now :previous_label; the old name has been deprecated.")
+ WillPaginate::Deprecation::warn(":prev_label view parameter is now :previous_label; the old name has been deprecated", caller)
options[:previous_label] = options.delete(:prev_label)
end
@@ -185,12 +185,11 @@ def page_entries_info(collection, options = {})
def self.total_pages_for_collection(collection) #:nodoc:
if collection.respond_to?('page_count') and !collection.respond_to?('total_pages')
- WillPaginate::Deprecation.warn <<-MSG
+ WillPaginate::Deprecation.warn %{
You are using a paginated collection of class #{collection.class.name}
which conforms to the old API of WillPaginate::Collection by using
`page_count`, while the current method name is `total_pages`. Please
- upgrade yours or 3rd-party code that provides the paginated collection.
- MSG
+ upgrade yours or 3rd-party code that provides the paginated collection}, caller
class << collection
def total_pages; page_count; end
end
Please sign in to comment.
Something went wrong with that request. Please try again.