1
0
Fork 0
mirror of https://github.com/kaminari/kaminari.git synced 2022-11-09 13:44:37 -05:00
kaminari--kaminari/lib/kaminari.rb
Akira Matsuda b7257f1442 The Rails module could be defined by some other gem than rails
kaminari depends on actionpack that in turn depends on rails-html-sanitizer the line https://github.com/amatsuda/kaminari/blob/master/lib/kaminari.rb#L36
returns true because rails-html-sanitizer defines the class Rails::Html::Sanitizer: https://github.com/rails/rails-html-sanitizer/blob/master/lib/rails-html-sanitizer.rb
see: https://github.com/amatsuda/kaminari/issues/796#issue-158648760

closes #796
2016-06-07 14:07:26 +09:00

39 lines
857 B
Ruby

module Kaminari
end
# load Rails/Railtie
begin
require 'rails'
rescue LoadError
#do nothing
end
$stderr.puts <<-EOC if !defined?(::Rails::Railtie) && !defined?(Sinatra) && !defined?(Grape)
warning: no framework detected.
Your Gemfile might not be configured properly.
---- e.g. ----
Rails:
gem 'kaminari'
Sinatra/Padrino:
gem 'kaminari', :require => 'kaminari/sinatra'
Grape:
gem 'kaminari', :require => 'kaminari/grape'
EOC
# load Kaminari components
require 'kaminari/config'
require 'kaminari/helpers/action_view_extension'
require 'kaminari/helpers/paginator'
require 'kaminari/models/page_scope_methods'
require 'kaminari/models/configuration_methods'
require 'kaminari/hooks'
# if not using Railtie, call `Kaminari::Hooks.init` directly
if defined? ::Rails::Railtie
require 'kaminari/railtie'
require 'kaminari/engine'
end