Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

will_paginate won't work in production #268

Closed
ivliaspiration opened this Issue · 6 comments

6 participants

Paul Nossoff Mika Mustalahti David Morcillo Mislav Marohnić mxtopher vijaypapasani
Paul Nossoff

will_paginate works flawlessly in development mode. But after deployment to staging server (which has the same config as production) I get method_missing errors for #paginate:

 A NoMethodError occurred in reports#search:
 undefined method `paginate' for #<ActiveRecord::Relation:0xc60299c>
 activerecord (3.1.3) lib/active_record/relation.rb:459:in `method_missing'

The funny thing is that if I ssh to the server and run rails console, everything works as expected:

RAILS_ENV=staging bundle exec rails c
Loading staging environment (Rails 3.1.3)
irb(main):001:0> Report.paginate(page: 1)
    Report Load (2.0ms)  SELECT "reports".* FROM "reports" ORDER BY updated_at DESC LIMIT 30  OFFSET 0

I'm using Ruby 1.9.3-p125, Rails 3.1.3 and will_paginate 3.0.3.

I've tried restarting unicorn, with no luck.

Mika Mustalahti

Just happened to me also. Seems that the whole gem is not loaded correctly. Also self.per_page= was throwing error before the application was even starting up.

David Morcillo

I'm having the same issue but with the page method:

NoMethodError (undefined method `page' for #<ActiveRecord::Relation
...
David Morcillo

I found the solution requiring "will_paginate" explicitly on my class file. I'm playing with datatables and the error appeared on my datatable class.

Mislav Marohnić
Owner

Probably an error with your deploy/production bundle.

Mislav Marohnić mislav closed this
mxtopher

My error was dumb. Maybe it can help someone.

I was including will_paginate under assets group in my Gemfile.

Yeah. I was. Kill me.

vijaypapasani

I am also getting same problem .. But i tried in rails console mode working fine in production with nginx server. i checked in rails production log file undefined paginate. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.