G
Gabriel Saravia
I'm running:
rvm/gems/ruby-1.8.7-p302/gems/fastercsv-1.5.3
I have a csv file that includes many rows here's an example snippet
including the header row:
First Name, Last Name, Email, Password, Roles
Sophia, Jackson, (e-mail address removed), abc123, UserRole1
Olivia, Davis, (e-mail address removed), abc123, User Role2
Alexander, Thomas, (e-mail address removed), abc123, "UserRole1, User Role2"
my code is:
fcsv = FasterCSV.open(self.csv_file_name, "rb", {:headers => true,
:return_headers => false})
fcsv.each do |row|
user = User.new(csv_row_to_user_attributes(row))
I have no problems with any row above Alexander, each user of which only
has 1 role, UserRole1 or User Role2. But on Alexander I get an "Illegal
quoting" error.
I thought that this was the correct way to handle this situation
according to the standard. I do not want the quotes to be returned as
part of my string, i just want the string that is the user roles. One
set of quotes returns me the error illegal quoting, two sets of quotes
returns me the same error. Shouldn't three sets include the quotes as
part of the string? Well, it still returns me the same error.
What am I doing wrong? thanks.
-Gabe
rvm/gems/ruby-1.8.7-p302/gems/fastercsv-1.5.3
I have a csv file that includes many rows here's an example snippet
including the header row:
First Name, Last Name, Email, Password, Roles
Sophia, Jackson, (e-mail address removed), abc123, UserRole1
Olivia, Davis, (e-mail address removed), abc123, User Role2
Alexander, Thomas, (e-mail address removed), abc123, "UserRole1, User Role2"
my code is:
fcsv = FasterCSV.open(self.csv_file_name, "rb", {:headers => true,
:return_headers => false})
fcsv.each do |row|
user = User.new(csv_row_to_user_attributes(row))
I have no problems with any row above Alexander, each user of which only
has 1 role, UserRole1 or User Role2. But on Alexander I get an "Illegal
quoting" error.
I thought that this was the correct way to handle this situation
according to the standard. I do not want the quotes to be returned as
part of my string, i just want the string that is the user roles. One
set of quotes returns me the error illegal quoting, two sets of quotes
returns me the same error. Shouldn't three sets include the quotes as
part of the string? Well, it still returns me the same error.
What am I doing wrong? thanks.
-Gabe