to_csv-rails 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/CHANGELOG +4 -1
  2. data/README.rdoc +29 -31
  3. data/VERSION +1 -1
  4. metadata +2 -2
data/CHANGELOG CHANGED
@@ -8,4 +8,7 @@
8
8
  Added custom header column names
9
9
 
10
10
  0.1.4
11
- Fixed commas not escaped
11
+ Fixed commas not escaped
12
+
13
+ 0.1.5
14
+ Update document
@@ -1,48 +1,46 @@
1
- == to_csv on Rails
1
+ == Export to CSV on Rails
2
2
 
3
3
  This simple plugin gives you the ability to call to_csv to a collection of activerecords. The builder options are the same as to_json / to_xml, except for the :include.
4
4
 
5
5
 
6
- == Usage
6
+ == Getting Started
7
7
 
8
- @posts = Post.all
9
-
10
- #
11
- # default are export header and all fileds
12
- #
13
-
14
- @posts.to_csv
15
- @posts.to_csv(:only => [:title, :body])
16
- @posts.to_csv(:except => [:id])
17
- @posts.to_csv(:header => false)
8
+ In your Gemfile:
9
+
10
+ gem 'to_csv-rails'# Last officially released gem
11
+ # gem "meta_search", :git => "git://github.com/liangwenke/to_csv-rails.git" # Track git repo
12
+
13
+ or, to install as a gem:
14
+
15
+ gem install to_csv-rails
18
16
 
17
+ or, to install as a plugin:
19
18
 
20
- == Example
19
+ rails plugin install git://github.com/liangwenke/to_csv-rails.git
21
20
 
22
- class PostsController < ApplicationController
23
- def index
24
- @posts = Post.all
25
-
26
- respond_to do |format|
27
- format.csv { send_data(@posts.to_csv) }
28
- #format.csv {
29
- # filename = "posts-#{Time.now.strftime("%Y%m%d%H%M%S")}.csv"
30
- # send_data(@posts.to_csv, :type => "text/csv; charset=utf-8; header=present", :filename => filename)
31
- #}
32
- end
21
+ In your controller:
22
+
23
+ def index
24
+ @posts = Post.all
25
+
26
+ respond_to do |format|
27
+ format.csv { send_data(@posts.to_csv) }
28
+ # format.csv {
29
+ # filename = "Posts-#{Time.now.strftime("%Y%m%d%H%M%S")}.csv"
30
+ # send_data(@posts.to_csv, :type => "text/csv; charset=utf-8; header=present", :filename => filename)
31
+ # }
33
32
  end
34
33
  end
35
34
 
36
35
 
37
- == Install
36
+ == Advanced usage
38
37
 
39
- gem install to_csv-rails
40
-
41
- gem 'to_csv-rails'
42
- bundle install
38
+ @posts.to_csv
39
+ @posts.to_csv(:only => [:title, :body])
40
+ @posts.to_csv(:except => [:id])
41
+ @posts.to_csv(:header => false)
43
42
 
44
- git clone http://github.com/liangwenke/to_csv-rails.git
45
43
 
46
- == Note
44
+ == Copyright
47
45
 
48
46
  Copyright (c) 2010 liangwenke.com@gmail.com, released under the MIT license
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: to_csv-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-30 00:00:00.000000000 Z
12
+ date: 2013-04-09 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: This simple plugin gives you the ability to call to_csv to a collection
15
15
  of activerecords. The builder options are the same as to_json / to_xml, except for