I feel stupid... but here goes: How do I write and execute SQL without a model? I just want to insert (or select) some various information but don''t want to bother with a model class and save() method, etc.... i want: sql = "insert into table values (stuff)" execute(sql) or sql = "select * from modelless table" result_array = execute(sql) --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
ActiveRecord::Base.connection.execute(sql) On 11/2/06, Chad <carimura-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > > I feel stupid... but here goes: > > How do I write and execute SQL without a model? I just want to insert > (or select) some various information but don''t want to bother with a > model class and save() method, etc.... > > i want: > > sql = "insert into table values (stuff)" > execute(sql) > > or > > sql = "select * from modelless table" > result_array = execute(sql) > > > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
thank you On Nov 1, 11:28 pm, "Jonathan Viney" <jonathan.vi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> ActiveRecord::Base.connection.execute(sql) > > On 11/2/06, Chad <carim...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I feel stupid... but here goes: > > > How do I write and execute SQL without a model? I just want to insert > > (or select) some various information but don''t want to bother with a > > model class and save() method, etc.... > > > i want: > > > sql = "insert into table values (stuff)" > > execute(sql) > > > or > > > sql = "select * from modelless table" > > result_array = execute(sql)--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---