Ruby on Rails Thursday, July 1, 2010

RailsFan Radha wrote:
[...]
> What is the bext practice in this case? (Yes, I always want to show the
> active records only ).
> Using find_by_sql or using a condition in the find :all ? ( I like SQLs,
> but as far as the performance goes which approach is better? )

The performance is probably equivalent. The maintainability, however,
is not. find_by_sql locks your code to one DB server and makes it less
maintainable. *Do not* use find_by_sql unless you have no other choice
-- write your code with ActiveRecord find syntax whenever possible.

>
>
> Can someone throw light in this please?
>
> - thanks

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen@marnen.org
--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment