The following code works locally (parsing a CSV with specific headers) but when on Heroku I get the following error on the ''next if'' row: TypeError (can''t convert String into Integer) CSV.parse(File.open(file_path, ''r'').read.gsub(/"/, ''''), :headers => true) do |row| next if row[''Customer''] && row[''Customer''].strip == ''. standard note format'' ... end So, before I rewrite my code and pull out named columns and just use integers (named columns certainly makes life easier) as the error message is suggesting, does anyone have an idea why this would be happening? Rails 3.0.3, Ruby 1.9.2 -- 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.
I had an issue but only when migrating a CSV into a table: I got it right by removing the attr_accessable flags but dont think its a good idea to change this if its part of the app -- 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 Jan 24, 6:03 pm, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote:> The following code works locally (parsing a CSV with specific headers) but > when on Heroku I get the following error on the ''next if'' row: > > TypeError (can''t convert String into Integer) > > CSV.parse(File.open(file_path, ''r'').read.gsub(/"/, ''''), :headers => > true) do |row| > next if row[''Customer''] && row[''Customer''].strip == ''. standard note > format'' > ... > end > > So, before I rewrite my code and pull out named columns and just use > integers (named columns certainly makes life easier) as the error message is > suggesting, does anyone have an idea why this would be happening? > > Rails 3.0.3, Ruby 1.9.2Is it definitely ruby 1.9.2 locally and on heroku ? in 1.9.2 CSV is actually the library previously known as fastercsv, which has slightly different semantics in places 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-/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.
On Mon, Jan 24, 2011 at 2:14 PM, Frederick Cheung < frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On Jan 24, 6:03 pm, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote: > > The following code works locally (parsing a CSV with specific headers) > but > > when on Heroku I get the following error on the ''next if'' row: > > > > TypeError (can''t convert String into Integer) > > > > CSV.parse(File.open(file_path, ''r'').read.gsub(/"/, ''''), :headers => > > true) do |row| > > next if row[''Customer''] && row[''Customer''].strip == ''. standard > note > > format'' > > ... > > end > > > > So, before I rewrite my code and pull out named columns and just use > > integers (named columns certainly makes life easier) as the error message > is > > suggesting, does anyone have an idea why this would be happening? > > > > Rails 3.0.3, Ruby 1.9.2 > > Is it definitely ruby 1.9.2 locally and on heroku ? in 1.9.2 CSV is > actually the library previously known as fastercsv, which has slightly > different semantics in places >Thanks Fred. Before I saw your note I poked around and found that my heroku app (actually any default heroku app) is running on Ruby 1.8.7, and yes, in dev I am running 1.9.2. So I migrated to heroku bamboo 1.9.2: heroku stack:migrate bamboo-mri-1.9.2 And everything now works. So yes, you are right on, was a ruby version issue.> > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@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.
Maybe Matching Threads
- Toto blog date issue - production only, localhost fine
- Did rails or shoulda go insane on the inflection of 'taxes'?
- Date parse - month and day reversed
- Rails 3 Active Record query returns "undefined method `loaded?' for #<Array:0x126a4c>"
- How do you execute "rails runner" in Heroku?