]> git.openstreetmap.org Git - rails.git/blobdiff - lib/classic_pagination/pagination.rb
Merge remote-tracking branch 'openstreetmap/pull/1085'
[rails.git] / lib / classic_pagination / pagination.rb
index 990a53d8b1d55be2b7561782854f510898d86e80..ee0c5b7dce015d99e43e634040be9eccb4eca064 100644 (file)
@@ -98,7 +98,7 @@ module ActionController
               unknown_option_keys.empty?
 
       options[:singular_name] ||= ActiveSupport::Inflector.singularize(collection_id.to_s)
-      options[:class_name]  ||= ActiveSupport::Inflector.camelize(options[:singular_name])
+      options[:class_name] ||= ActiveSupport::Inflector.camelize(options[:singular_name])
     end
 
     # Returns a paginator and a collection of Active Record model instances
@@ -155,8 +155,7 @@ module ActionController
 
     def create_paginators_and_retrieve_collections #:nodoc:
       Pagination::OPTIONS[self.class].each do |collection_id, options|
-        next unless options[:actions].include? action_name if
-          options[:actions]
+        next if options[:actions] && !options[:actions].include?(action_name)
 
         paginator, collection =
           paginator_and_collection_for(collection_id, options)
@@ -359,13 +358,13 @@ module ActionController
         # Returns a new Page object representing the page just before this
         # page, or nil if this is the first page.
         def previous
-          if first? then nil else @paginator[@number - 1] end
+          first? ? nil : @paginator[@number - 1]
         end
 
         # Returns a new Page object representing the page just after this
         # page, or nil if this is the last page.
         def next
-          if last? then nil else @paginator[@number + 1] end
+          last? ? nil : @paginator[@number + 1]
         end
 
         # Returns a new Window object for this page with the specified