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


2009/11/10 Hiro Protagonist <[email protected]>

>
> # This is a sanitized example of what I am doing at work and was
> perplexed
>
> def Person.find_by_name(*params)
>    puts "hello world!"
>    params.first.chop! if params.first.last == "."
>    super
> end
>
> # It strips the trailing . and puts hello world!
> >> Person.find_by_name("Chris.")
> "hello world!"
> => #<Person id: 1, :name: "Chris">
>
> # I hit up arrow and enter
>
> => nil
>
> # Why is the method not actually being called the second time?
> # I can handle never working and always working, but always working
> once I can't handle.
>
> Thanks,
> Chris Lundquist
>
> >
>


-- 
Ryan Bigg

--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to