On Wed, Jan 5, 2011 at 5:50 PM, Marnen Laibow-Koser <[email protected]>wrote:

> Colin Law wrote in post #972572:
> > On 5 January 2011 17:38, Fernando Leandro
> > <[email protected]> wrote:
> >>
> >>
> >> FROM courses
> >>
> >> I know that this question is not about rails but i need to solve this
> >> problem to continue my rails app,
> >> and i would appreciate if someone could help me..
> >
> > You can make it a Rails question by re-formulating the question in
> > terms of your ActiveRecord relationships and asking how to code a find
> > operation to return the objects you want.  In practice this should be
> > your initial approach anyway, only resorting to SQL if you cannot code
> > it using Rails helpers.
>
> Agreed -- mostly.  I'm very comfortable with SQL, so I often find it
> helpful to consider a query in SQL terms first, and then figure out how
> to abstract that SQL with ActiveRecord.  That usually leads to better
> queries anyway -- ActiveRecord can be ridiculously inefficient for
> certain operations.
>
> Could you name some of these certain operations where its better to go for
SQL queries instead of ActiveRecord.
Also, is ARel also inefficient for the certain operations that you are
mentioning??
Until now, I have learned that you should not write SQl queries in your
code, rather go for Active Record, as it allows you to change your choice of
database later on. But, If you are certain that you are going to use MySQL
or a specific DB for an app then I guess there is no problem in going for
SQL queries.
Please correct me, if I am wrong somewhere.

> >
> > Colin
>
> Best,
> --
> Marnen Laibow-Koser
> http://www.marnen.org
> [email protected]
>
> --
> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

-- 
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 [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-talk?hl=en.

Reply via email to