ok - I see I can do the following

   ActiveRecord::Base.connection.select_all('select * from categories')

and get a hash back



2009/2/2 Greg Hauptmann <greg.hauptmann.r...@gmail.com>:
> Hi,
>
> If I want to return SQL data that cuts across multiple models (e.g.
> not specific to one mode) how do I do this?  Actually the use case
> could be either (a) custom SQL I want to call or via (b) SQL call to a
> database view I've created?
>
> The select method
> http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/DatabaseStatements.html#M001704
> seems to be what I need however when I try to use this I'm getting an
> error:
>
>>> ActiveRecord::Base.connection.select("select * from categories")
> NoMethodError: private method `select' called for
> #<ActiveRecord::ConnectionAdapters::MysqlAdapter:0x253710c>
>        from (irb):11
>>>
>
>
>
>
> --
> Greg
> http://blog.gregnet.org/
>



-- 
Greg
http://blog.gregnet.org/

--~--~---------~--~----~------------~-------~--~----~
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