1

Sinatra アプリケーションがあります。を追加した後gem 'kaminari'、次のエラーが発生し始めます

/var/lib/gems/1.9.1/gems/backports-2.7.1/lib/backports/tools.rb:318:in `require': cannot load such file -- rails (LoadError)
        from /var/lib/gems/1.9.1/gems/backports-2.7.1/lib/backports/tools.rb:318:in `require_with_backports'
        from /var/lib/gems/1.9.1/gems/kaminari-0.11.0/lib/kaminari/railtie.rb:1:in `<top (required)>'
        from /var/lib/gems/1.9.1/gems/backports-2.7.1/lib/backports/tools.rb:318:in `require'
        from /var/lib/gems/1.9.1/gems/backports-2.7.1/lib/backports/tools.rb:318:in `require_with_backports'
        from /var/lib/gems/1.9.1/gems/kaminari-0.11.0/lib/kaminari.rb:2:in `<top (required)>'
        from /var/lib/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `require'
        from /var/lib/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
        from /var/lib/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `each'
        from /var/lib/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `block in require'
        from /var/lib/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `each'
        from /var/lib/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `require'
        from /var/lib/gems/1.9.1/gems/bundler-1.2.3/lib/bundler.rb:128:in `require'
        from /home/alex/Documents/ruby_projects/app_base.rb:3:in `<top (required)>'
        from /home/alex/Documents/ruby_projects/app.rb:1:in `require_relative'
        from /home/alex/Documents/ruby_projects/app.rb:1:in `<top (required)>'
        from /home/alex/Documents/ruby_projects/config.ru:11:in `require'
        from /home/alex/Documents/ruby_projects/config.ru:11:in `block in <main>'
        from /var/lib/gems/1.9.1/gems/rack-1.5.1/lib/rack/builder.rb:55:in `instance_eval'
        from /var/lib/gems/1.9.1/gems/rack-1.5.1/lib/rack/builder.rb:55:in `initialize'
        from /home/alex/Documents/ruby_projects/config.ru:in `new'
        from /home/alex/Documents/ruby_projects/config.ru:in `<main>'
        from /var/lib/gems/1.9.1/gems/rack-1.5.1/lib/rack/builder.rb:49:in `eval'
        from /var/lib/gems/1.9.1/gems/rack-1.5.1/lib/rack/builder.rb:49:in `new_from_string'
        from /var/lib/gems/1.9.1/gems/rack-1.5.1/lib/rack/builder.rb:40:in `parse_file'
        from /var/lib/gems/1.9.1/gems/rack-1.5.1/lib/rack/server.rb:277:in `build_app_and_options_from_config'
        from /var/lib/gems/1.9.1/gems/rack-1.5.1/lib/rack/server.rb:199:in `app'
        from /var/lib/gems/1.9.1/gems/rack-1.5.1/lib/rack/server.rb:314:in `wrapped_app'
        from /var/lib/gems/1.9.1/gems/rack-1.5.1/lib/rack/server.rb:250:in `start'
        from /var/lib/gems/1.9.1/gems/rack-1.5.1/lib/rack/server.rb:141:in `start'
        from /var/lib/gems/1.9.1/gems/rack-1.5.1/bin/rackup:4:in `<top (required)>'
        from /usr/local/bin/rackup:23:in `load'
        from /usr/local/bin/rackup:23:in `<main>'

' でアプリケーションを起動しようとしたときrackup'。以前はうまくいきました。

どうすればそれを取り除くことができますか?

4

2 に答える 2

0

実際には、内部的に必要な/lib/kaminari/helpers/sinatra_helpers.rb ファイルの 128 ~ 129 行目は次のとおりです。

$stderr.puts "[!]You should install `padrino-helpers' gem if you want to use kaminari's pagination helpers with Sinatra."
$stderr.puts "[!]Kaminari::Helpers::SinatraHelper does nothing now..."

したがって、padrino-helpers をインストールする必要があると思います。

于 2013-02-09T09:25:24.303 に答える
0

sinatra/padrino のサポートに関する kaminari README セクションでgem 'kaminari', :require => 'kaminari/sinatra'説明されているとおりにする必要があります。

于 2013-02-09T03:37:10.513 に答える