A Convenient Squirrel Addition

This is probably something that should have been done sooner, but I didn’t get around to it and it wasn’t immediately important to us. Since it now is, I changed Squirrel’s call to ActiveRecord::Base#find to include all parameters passed in, even the extra hash variables find normally uses. While this isn’t terribly amazing on its own (although it does mean you can use :limit even though it doesn’t have Squirrel-specific syntax yet), it allows the usage of the terribly lovely [paginating_find] plugin.

posts = Post.find(:all, :limit => 10) do
    created_on > 7.days.ago
end

orders = Order.find(:all, :page => { :size => 5, :current => 2 } ) do
    customer.id == params[:customer_id]
end

Both of these will work as expected now. Well, the second one needs paginating_find installed, but you know what I mean.

As always, the repo is on github.

Pair with one of our expert developers to level up your skills with Coaching by thoughtbot. Save time learning best practices and techniques for reducing technical debt in Ember, Ruby, Haskell, and Go in 1-on-1 sessions tailored to your goals.