1
0
Fork 0
mirror of https://github.com/kaminari/kaminari.git synced 2022-11-09 13:44:37 -05:00

fix load order when using with sinatra

This commit is contained in:
Uchio Kondo 2011-12-11 13:07:08 +09:00
parent f2664f0086
commit 507617cb58
2 changed files with 21 additions and 1 deletions

View file

@ -10,7 +10,7 @@ module Kaminari
end
def self.load_framework!
raise "No framework specified!" if frameworks.empty?
show_warning if frameworks.empty?
frameworks.each do |framework|
begin
require framework
@ -20,6 +20,20 @@ module Kaminari
end
end
def self.show_warning
$stderr.puts <<-EOC
warning: no framework is detected.
would you check out if your Gemfile appropriately configured?
---- e.g. ----
when Rails:
gem 'rails'
gem 'kaminari'
when Sinatra/Padrino:
gem 'kaminari', :require => 'kaminari/sinatra'
EOC
end
def self.load_kaminari!
require 'kaminari/config'

View file

@ -1,3 +1,9 @@
begin
require 'sinatra/base'
rescue LoadError
raise LoadError, 'couldn\'t load `sinatra/base\', check out if appropriately bundled sinatra gem?'
end
require 'kaminari'
module Kaminari
module Helpers