John Mcleod wrote: > Hello all, > I've been getter better with Rails but I'm still just learning. > > Here's what I have. > I have one table (imports) and I read in a csv into this table. > After doing some preliminary editing to each record I wish to insert all > records into another table (projects) in one shot. > I could create a new method in the projects controller and then call the > "create", but doesn't that only insert one record?
Yes. In this case, if the tables have the same structure, you might want to use SQL's INSERT SELECT syntax (see your DB for details). But having two tables with identical structure is smelly. Why not just use a flag and a named_scope? > > I need a little clarity on this. > > I know how to delete all records from a table. I wonder if it's as > simple? Rails doesn't abstract this AFAIK, in part because this is very rarely needed. > > Thank you for any help. > > JohnM Best, -- Marnen Laibow-Koser http://www.marnen.org [email protected] -- 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

