Skip to content

Commit

Permalink
Added CSV generator options
Browse files Browse the repository at this point in the history
  • Loading branch information
vidmantas committed May 12, 2009
1 parent eb15b10 commit 56c1cc6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion README
Expand Up @@ -34,12 +34,17 @@ e.g.

@filename = 'report.csv'

You can also set the input encoding and output encoding by setting
You can set the input encoding and output encoding by setting
<tt>@input_encoding</tt> and <tt>@output_encoding</tt> instance variables.
These default to 'UTF-8' and 'LATIN1' respectively. e.g.

@output_encoding = 'UTF-8'

You can set <tt>@csv_options</tt> instance variable to define options for FasterCSV
generator. For example:

@csv_options = { :force_quotes => true, :col_sep => ';' }

You can also attach a csv file to mail sent out by your application by
including a snippet like the following in your mailer method

Expand Down
2 changes: 1 addition & 1 deletion lib/csv_builder.rb
Expand Up @@ -43,7 +43,7 @@ def compile(template)
controller.response.headers['Content-Disposition'] = "attachment; filename=\#{@filename}"
end
result = FasterCSV.generate do |csv|
result = FasterCSV.generate(@csv_options) do |csv|
#{template.source}
end
Expand Down

0 comments on commit 56c1cc6

Please sign in to comment.