I may be a little biased (I just submitted a patch related to method_missing
and dynamic finders -  http://dev.rubyonrails.org/ticket/9317), but I think
such a change would be ill-advised. For one thing, I can't think of a
version of this syntax that would look acceptable when you're checking
multiple attributes:
User.find_by([:name, :age], ["Joe", 21]) # just... no

User.find_by(:name => "Joe", :age => 21) # better, but then why not just
use:

User.find(:all, :conditions => {:name => "Joe", :age => 21})

I don't know that the hash version is noticeably easier than passing a hash
to :conditions...

As for performance - performance doesn't appear to suffer too much with the
method missing implementation:
http://m.onkey.org/2007/8/18/ar-dynamic-finders-are-soooo-slow-not (and with
my aforementioned patch, it's even less of an issue).

I can't speak to the stack trace, since I haven't futzed around with it
anyway to check just how much it would change...

Ben


On 8/20/07, Courtenay <[EMAIL PROTECTED]> wrote:
>
>
> What do you all think of this syntax:
>
>   User.find_by(:name, "Joe")
>
> instead of
>
>   User.find_by_name("joe")
>
> thus removing at least part of the method_missing hack, and also,
> removing a little of the magic "What is this find_by_stuff and why
> can't I see it in the API?"
>
> I hear that it'll speed things up and the stacktraces will be simpler.
>
>
>
> Apologies if this has been covered previously.
>
> Courtenay
>
> --~--~---------~--~----~------------~-------~--~----~
> 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 rubyonrails-core-unsubscribe
> @googlegroups.com
> For more options, visit this group at http://groups.google.com/group
> /rubyonrails-core?hl=en
> -~----------~----~----~----~-- ----~----~------~--~---
>
>

--~--~---------~--~----~------------~-------~--~----~
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