Hi. I am in the process of making an application that should handle imports of the content csv. I plan on incorporating AJAX when I get more routine (so the page don''t have to redirect back after the upload), but for now I am looking for the simplest upload function. A file could for example be (First_name;Last_name;Age;State): Andrew;McDonald;78;California I am quite new to Rails, so nothing fancy. Preferably some basic code in View, Controller and Model. My sqlite3 database has a table that contains the corresponding columns. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 9 June 2012 16:42, Anders Andrew <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hi. > > I am in the process of making an application that should handle imports > of the content csv. I plan on incorporating AJAX when I get more routine > (so the page don''t have to redirect back after the upload), but for now > I am looking for the simplest upload function. A file could for example > be (First_name;Last_name;Age;State): > > Andrew;McDonald;78;California > > I am quite new to Rails, so nothing fancy. Preferably some basic code in > View, Controller and Model. > > My sqlite3 database has a table that contains the corresponding columns.Which bit do you need help with, the upload or parsing the data? If the upload have you tried googling for rails upload? Colin> > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Anders Andrew
2012-Jun-09 17:07 UTC
Re: A simple csv import function to my Rails application
Colin Law wrote in post #1063851:> On 9 June 2012 16:42, Anders Andrew <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> I am quite new to Rails, so nothing fancy. Preferably some basic code in >> View, Controller and Model. >> >> My sqlite3 database has a table that contains the corresponding columns. > > Which bit do you need help with, the upload or parsing the data? If > the upload have you tried googling for rails upload? > > ColinHi Colin. I think that what I am looking for is something this: http://stdlib.rubyonrails.org/libdoc/csv/rdoc/classes/CSV/Reader.html I have tryed implementing the one from this article: http://satishonrails.wordpress.com/2007/07/18/how-to-import-csv-file-in-rails/ But get this error message: "uninitialized constant CSV::Reader". -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Linus Pettersson
2012-Jun-10 12:28 UTC
Re: A simple csv import function to my Rails application
Have you added *require* ''csv'' ? Den lördagen den 9:e juni 2012 kl. 19:07:49 UTC+2 skrev Ruby-Forum.com User:> > Colin Law wrote in post #1063851: > > On 9 June 2012 16:42, Anders Andrew <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > >> I am quite new to Rails, so nothing fancy. Preferably some basic code > in > >> View, Controller and Model. > >> > >> My sqlite3 database has a table that contains the corresponding > columns. > > > > Which bit do you need help with, the upload or parsing the data? If > > the upload have you tried googling for rails upload? > > > > Colin > > Hi Colin. > > I think that what I am looking for is something this: > > http://stdlib.rubyonrails.org/libdoc/csv/rdoc/classes/CSV/Reader.html > > I have tryed implementing the one from this article: > > > http://satishonrails.wordpress.com/2007/07/18/how-to-import-csv-file-in-rails/ > > But get this error message: "uninitialized constant CSV::Reader". > > -- > 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 view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/HU3c-ndtz4cJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.