I'm creating a CSV download in my Ruby application which has some Dollar amount fields. These fields has data in cyrrency format like $35,456 and when such data comes in CSV it get seperated into two fiedls , data after comma moved to next column in CSV.
Here is my code to render CSV
Sell Date, Sell Amount
- @rows.each do |row|
= "#{row[0]},#{number_to_currency(row[1], :precision => 2)}"
Here is the action used to return CSV
def fifolog
@rows = Report.fifolog()
respond_to do |format|
format.csv { render csv: {:rows =>@rows }}
end
end
Is there any escape character i can use to escape "," in ruby
thanks