Peter Marklund's Home
I'm at the Big Nerd Ranch Ruby on Rails bootcamp in a monastery outside Frankfurt right now having a great time. One of the students asked if you can say ActiveRecord::Base.find(:last), which you can't. The value of the first argument is typically :first, but you can't use :last. Just for educational purposes I decided to change that (it's probably not something I would use in production):
ActiveRecord::Base # Make sure class is loaded, which it probably is by now anyway if args.first == :last options = extract_options_from_args!(args) find_without_last(:first, options.merge(:order => " DESC")) else find_without_last(*args) end end end end end
I guess most interestingly this code illustrates how to alias a static method.