I want ‘logical OR’ dynamic finders in ActiveRecord. Anybody seen such a thing?
So in the spirit of something like this..
User.find_by_name_and_email("foo", "bar@thud.com")
.. you could do stuff like this..
User.find_by_username_or_email(user_input)
How often are you really going to have fields in your database that will have ientical values that you can look up like that? Enough to worry about using a dynamic finder method? Probably not. What’s wrong with a named_scope for this?
That does what you want, and I just don’t think this kind of thing will pop up often enough to justify dynamic finders for it, but hey I could be wrong.