On Wed, Jan 16, 2008 at 07:26:00AM -0800, Carr0t wrote: > This came up when I migrated from rails 1.2.3 to 2.0.2. Previously, my > code was working fine. I am using > a mysql backend database, in which I am storing IPv4 addresses as 32 > bit unsigned integers. Of course, I don't want my users to have to > enter the IP they are searching for in this fashion, nor do I want to > have to make the conversion myself every time I call the find_by_ip > function or find_or_create_by_ip function for the model, so I have > overloaded those two functions. find_by_ip now reads as follows: > > def self.find_by_ip(ip) > super(NetAddr::CIDR.create(ip).to_i) > end
Don't use super(), instead construct the call to find yourself. That'll avoid calling method_missing, which will avoid the automatic creation of methods you don't want. - Matt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
