I have upgraded my application from rails 2.3.8 to 3.0.3 . But I'm facing a problem. I was using 'find' but the overriding doesn't work in rails 3:
# override activerecord's find to allow us to find by name or id transparently def self.find(*args) if args.is_a?(Array) and args.first.is_a?(String) and (args.first.index(/[a-zA-Z\-_]+/) or args.first.to_i.eql?(0) ) find_by_login_slug(args) else super end end
I'm wondering if there is a way to make this work in rails 3 or even by using where instead.
preguntado el 09 de enero de 11 a las 11:01
The problem you're are facing is an upgrading from a rails 2.3.X to a rails 3.0.X application. Although, it could seem a simple task it isn't, especially if you have a real application and not a toy one. I suggest you to take a look to a screencast series from Rayn Bates, you could start from http://railscasts.com/episodes/225-upgrading-to-rails-3-part-1 to get a complete idea off the problem you are facing.
If you only need to read about ActiveRecord new interface http://m.onkey.org/active-record-query-interface is a great article.