On 8/21/07, Pratik <[EMAIL PROTECTED]> wrote: > > > Even though I like Site.find_by(:domain, request.host) more that > Site.find_by_domain, it seems like we're solving the wrong problem.
I like find_by_domain more (nicer to type and look at) and I also feel that "solving" this is wrong. You said that the downside of dynamic finders is that they don't show up in API documentation, and people are confused where the methods got from. Well, this may be true for people who have never read the basic documentation for AR::Base, because the concept of dynamic finders is nicely outlined there. Those who have quickly realize the methods are a no-brainer. What about dynamic getters and setters on models: how to explain to people that their Post instances have "title" and "published_at" properties? Do those appear in API documentation? When people started using will_paginate more, I've noticed more and more people asked "this paginate_by_domain method, where did it come from? where did 'paginate' come from?". This is because the whole will_paginate API is just method_missing. I've then written a lot of Rdoc for the plugin explaining the dynamic nature of the API, and that helped. People understood that will_paginate creates a thin, virtual layer over the existing finder API, part of which is also dynamic (find_by_domain). And they understand find_by_foo_and_bar because they have at least glanced at AR::Base docs. So in short, I don't believe the "lack" of documentation and the confusion it "causes" justifies deprecating the API. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
