确认will_paginate已加载

时间:2013-10-30 18:33:37

标签: ruby-on-rails ruby unicorn will-paginate rvm-capistrano

解决我的问题,Why do I get “undefined method 'paginate'” error in production?我正在讨论

bundle exec rails runner -e production 'WillPaginate'
服务器上的

就像这个github问题中的建议一样: https://github.com/mislav/will_paginate/issues/308#issuecomment-17167158

问题:如果我没有得到任何输出,是否确认,will_paginate正常运行?

我正在使用:Ruby 2.0.0p247,Rails 4.0.0,Ubuntu 12.10 LTS,Unicorn,Capistrano

1 个答案:

答案 0 :(得分:1)

你是对的:如果你没有看到输出,这意味着Ruby能够解析常量,这意味着在生产环境中正确加载了will_paginate。

如果不是,您将看到“未初始化的常量”错误,如下所示:

/home/ash/.rbenv/versions/2.1.0-preview1/lib/ruby/gems/2.1.0/gems/railties-4.0.0/lib/rails/commands/runner.rb:53:in `eval': uninitialized constant WillPaginate (NameError)
        from /home/ash/.rbenv/versions/2.1.0-preview1/lib/ruby/gems/2.1.0/gems/railties-4.0.0/lib/rails/commands/runner.rb:53:in `eval'
        from /home/ash/.rbenv/versions/2.1.0-preview1/lib/ruby/gems/2.1.0/gems/railties-4.0.0/lib/rails/commands/runner.rb:53:in `<top (required)>'
        from /home/ash/.rbenv/versions/2.1.0-preview1/lib/ruby/gems/2.1.0/gems/railties-4.0.0/lib/rails/commands.rb:86:in `require'
        from /home/ash/.rbenv/versions/2.1.0-preview1/lib/ruby/gems/2.1.0/gems/railties-4.0.0/lib/rails/commands.rb:86:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'