4 ms·
What's the great benefit of these methods? Why not just do find_by("url", x)? I just don't understand the desire to move string parameters into member names.
by MichaelGG 14y ago
What's the great benefit of these methods? Why not just do find_by("url", x)? I just don't understand the desire to move string parameters into member names.
- xentronium 14y agoThere is slight benefit in readability for cases like find_by_name_and_role("Jack", "admin"), but other than that, no benefit whatsoever. In Rails 4.0, most dynamic finders are deprecated and removed from the source into a separate gem.
- awj 14y agoThat method predates the "Forum.where(:url => ...)" syntax of xentronium's demo code. Previously it looked like this: "Forum.find(:first, :conditions => {:url => ...})". Dynamic finders were really sugar over this form, which was always kind of an eyesore.