> May I suggest aliasing the method instead of trying to call super?
> alias_method :old_find_by_name, :find_by_name
> def Person.find_by_name(*params)
>   params.first.chop! if params.first.last == "."
>   old_find_by_name(params)
> end

super won't work here because the method isn't defined on a parent of
Person, it's defined on person itself.  So what's happening is that
the call to method missing is generating a *new* implementation of
find_by_name which simply does the find, without your changes.

We could fix this for rails 3.0 by moving those generated methods from
Person to a module included in person, but for 2.3 you'll have to do
as Ryan suggests and use aliasing, or just call
all(:conditions=>{:first_name=>params.first}) instead of super.

-- 
Cheers

Koz

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-core+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to