to_csv-rails 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -1
- data/README.rdoc +29 -31
- data/VERSION +1 -1
- metadata +2 -2
data/CHANGELOG
CHANGED
data/README.rdoc
CHANGED
@@ -1,48 +1,46 @@
|
|
1
|
-
==
|
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
|
-
==
|
6
|
+
== Getting Started
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
#
|
11
|
-
#
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
-
|
19
|
+
rails plugin install git://github.com/liangwenke/to_csv-rails.git
|
21
20
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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
|
-
==
|
36
|
+
== Advanced usage
|
38
37
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
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
|
-
==
|
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.
|
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
|
+
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-
|
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
|