Overloading 'find'

How would I overload find?

I got some excellent help on mixins for my classes using lib/, but it
doesn’t allow find to be overloaded. I’m testing with the example method
below:

module myModule

  def find(*args)
     options = extract_options_from_args!(args)
     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
     find_initial(options)
   end

end

So it will always return the initial data. In the class, I’m including
myModule.

class klass
include myModule

end

Rails works normally, returning all results instead of the initial. How
do I overload find to implement a new find?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs