3

i can not get Kaminari work together with unscope, here's what I'm experiencing,

https://gist.github.com/1330721

Any thoughts on this?

Akira Matsuda
  • 1,854
  • 14
  • 9
leomayleomay
  • 553
  • 1
  • 7
  • 16
  • Works for me as advertised in Rails 3.1.1 and with Kaminari 0.12.4. You didn't mention your gem versions, so it's hard to say something more. – Ernest Nov 01 '11 at 17:26

1 Answers1

3

Your simplified code works for me with newest stable versions either, but anyway, if you're experiencing a strange behavior with default_scope + unscoped, it must be caused by this AR bug. https://rails.lighthouseapp.com/projects/8994/tickets/5386-arbaseunscoped-inconsistency

So, as the document sais, I recommend you to avoid using unscoped method in method chaining. Use block style instead. https://github.com/rails/rails/blob/2407a7a/activerecord/lib/active_record/base.rb#L938

Article.unscoped { Article.page(nil).per(30) }.to_sql
Akira Matsuda
  • 1,854
  • 14
  • 9