I am new to rails and want to figure out the syntax for truncating a table using a rake file. Any ideas? thanks in advance! -- 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-/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?hl=en -~----------~----~----~----~------~----~------~--~---
On Tue, Mar 17, 2009 at 12:36 PM, Chris Gunnels < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I am new to rails and want to figure out the syntax for truncating a > table using a rake file. Any ideas? thanks in advance!Hi, what do you mean truncate a table? Do you mean delete the contents of the table or delete the table? -Conrad> > -- > 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-/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?hl=en -~----------~----~----~----~------~----~------~--~---
Conrad Taylor wrote:> On Tue, Mar 17, 2009 at 12:36 PM, Chris Gunnels < > rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > >> >> I am new to rails and want to figure out the syntax for truncating a >> table using a rake file. Any ideas? thanks in advance! > > > Hi, what do you mean truncate a table? Do you mean delete the contents > of > the table or > delete the table? > > -Conraddelete the contents of the table -- 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-/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?hl=en -~----------~----~----~----~------~----~------~--~---
On Mar 17, 7:58 pm, Chris Gunnels <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Conrad Taylor wrote: > > On Tue, Mar 17, 2009 at 12:36 PM, Chris Gunnels < > > rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > > >> I am new to rails and want to figure out the syntax for truncating a > >> table using a rake file. Any ideas? thanks in advance! > > > Hi, what do you mean truncate a table? Do you mean delete the contents > > of > > the table or > > delete the table? > > > -Conrad > > delete the contents of the tableIf you make your task depend on the magic :environment task then activerecord will be loaded with your database configuration (and you models etc.) and you can just do MyModel.connection.execute "..." as you would have normally or just SomeModel.delete_all if you don''t care about the difference between truncate and deleting all rows. Fred --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---