Question

To solve my problem, which is discussed in Why do I get “undefined method 'paginate'” error in production? I'm running

bundle exec rails runner -e production 'WillPaginate'

on the server like suggested in this github issue: https://github.com/mislav/will_paginate/issues/308#issuecomment-17167158

Question: If I don't get any output, is that the confirmation, that will_paginate is running correctly?

I'm using: Ruby 2.0.0p247, Rails 4.0.0, Ubuntu 12.10 LTS, Unicorn, Capistrano

Was it helpful?

Solution

You're correct: if you see no output, that means that Ruby was able to resolve the constant, which means that will_paginate is loaded correctly in your production environment.

If it isn't, you'll see an "uninitialized constant" error, like so:

/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>'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top