Created
March 14, 2009 23:30
-
-
Save capotej/79229 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#you can now chain operations by scope | |
Order.scoped_by_customer_id(12) | |
Order.scoped_by_customer_id(12).find(:all, :conditions => "status = 'open'") | |
Order.scoped_by_customer_id(12).scoped_by_status("open") | |
#Customer is a trillion row table | |
Customer.find_in_batches(:conditions => {:active => true}) do |customer_group| | |
customer_group.each { |customer| customer.update_account_balance! } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment