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)"

See for more information:

http://www.fngtps.com/2008/11/free-result-after-using-activerecord-base-connection-execute

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 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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to