Hi guys, what do you think about this implementation (before I go off
and actually make it work). The plan is to make it easier to write
extensions or plugins for find, as well as define your own options for
the precious first-level argument, :first, :all, etc.
If you want to skip to the paste/diff, it's here: http://pastie.caboo.se/89252
The current way:
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 :all then find_every(options)
else find_from_ids(args, options)
end
end
A new way?
def find(*args)
options = args.extract_options!
validate_find_options(options)
set_readonly_option!(options)
finder.dispatch(args, options)
end
# The Finder class allows you to easily define your own custom
find implementations.
# Simply define this class in your model, and any of its methods
will be available
# to your #find call as the first symbol. For example,