Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
module ActiveRecord class Base class << self def find(*args) options = args.extract_options! validate_find_options(options) set_readonly_option!(options) case args.first when :first then find_initial(options) when :last then find_last(options) when :all then find_every(options) when :random then find_random(options) else find_from_ids(args, options) end end def random find(:first, :offset => rand(self.count)) end private def find_random(options) results = find_every(options) results[rand(results.count)] end end end end
This paste will be private.
From the Design Piracy series on my blog: