On Jun 19, 5:44 pm, Chris Hanks <rails-mailing-l...@andreas-s.net>
wrote:
> You might try
>
> ActiveRecord::Base.connection.execute "SELECT..."
>
> Or, in a model file, which is where you probably should be doing this
> kind of thing, I guess it would just be connection.execute "(query)"
>
select_all returns a more portable result (array of hashes rather than
something db specific)

Fred
> See for more information:
>
> http://www.fngtps.com/2008/11/free-result-after-using-activerecord-ba...
>
> If you just need to do a join, though, you can pass the :join option to
> active record in whatever query you're doing.
>
> Jedrin wrote:
> > How can I do sql inside of rails where active record is not
> > involved ? I have done find_by_sql type things before, but they always
> > return an active record. There may be a need on this project to do a
> > more typical sql select that does a join etc.
>
> --
> Posted viahttp://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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to