Skip to content

Commit

Permalink
update document
Browse files Browse the repository at this point in the history
  • Loading branch information
wenke committed Mar 30, 2013
1 parent 13e68c8 commit d674439
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions README.rdoc
Expand Up @@ -6,11 +6,11 @@ This simple plugin gives you the ability to call to_csv to a collection of activ
== Usage

@posts = Post.all

#
# default are export header and all fileds
#

@posts.to_csv
@posts.to_csv(:only => [:title, :body])
@posts.to_csv(:except => [:id])
Expand All @@ -22,13 +22,13 @@ This simple plugin gives you the ability to call to_csv to a collection of activ
class PostsController < ApplicationController
def index
@posts = Post.all

respond_to do |format|
format.csv { send_data(@posts.to_csv) }
#format.csv {
# filename = "posts-#{Time.now.strftime("%Y%m%d%H%M%S")}.csv"
# send_data(@posts.to_csv, :type => "text/csv; charset=utf-8; header=present", :filename => filename)
#}
# format.csv {
# filename = "posts-#{Time.now.strftime("%Y%m%d%H%M%S")}.csv"
# send_data(@posts.to_csv, :type => "text/csv; charset=utf-8; header=present", :filename => filename)
# }
end
end
end
Expand All @@ -37,7 +37,7 @@ This simple plugin gives you the ability to call to_csv to a collection of activ
== Install

gem install to_csv-rails

gem 'to_csv-rails'
bundle install

Expand Down

0 comments on commit d674439

Please sign in to comment.