will_paginate won't work in production #268

Closed
ivliaspiration opened this Issue Sep 23, 2012 · 6 comments

Comments

Projects
None yet
6 participants

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.

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.

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

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

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.

Owner

mislav commented Jan 10, 2013

Probably an error with your deploy/production bundle.

mislav closed this Jan 10, 2013

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.

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