Skip to content

Instantly share code, notes, and snippets.

View andreacampi's full-sized avatar

Andrea Campi andreacampi

  • Apple, inc
  • London, UK
View GitHub Profile
@wagenet
wagenet / better_default_scope.rb
Created March 18, 2009 15:30
Improved Nested Scopes, Including Blocks for Rails 2.3
# Based on http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1812-default_scope-cant-take-procs
ActiveRecord::Base.class_eval do
class << self
private
def find_last(options)
order = options[:order]