rocket_pants 1.4.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@ module RocketPants
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  def self.pagination_type(object)
6
- if defined?(WillPaginate::Collection) && object.is_a?(WillPaginate::Collection)
6
+ if object.respond_to?(:total_entries)
7
7
  :will_paginate
8
8
  elsif object.respond_to?(:num_pages) && object.respond_to?(:current_page)
9
9
  :kaminari
@@ -92,7 +92,9 @@ module RocketPants
92
92
  # register! :ninjas_unavailable, :http_status => :service_unavailable
93
93
  def self.register!(name, options = {})
94
94
  klass_name = (options[:class_name] || name.to_s.classify).to_sym
95
- klass = Class.new(Error)
95
+ base_klass = options[:base] || Error
96
+ raise ArgumentError, ":base must be a subclass of RocketPants::Error" unless base_klass <= Error
97
+ klass = Class.new(base_klass)
96
98
  klass.error_name(options[:error_name] || name.to_s.underscore)
97
99
  klass.http_status(options[:http_status]) if options[:http_status].present?
98
100
  (options[:under] || RocketPants).const_set klass_name, klass
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rocket_pants
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-28 00:00:00.000000000 Z
12
+ date: 2012-06-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack