File tree 1 file changed +19
-20
lines changed
1 file changed +19
-20
lines changed Original file line number Diff line number Diff line change @@ -19,39 +19,39 @@ This simple plugin gives you the ability to call to_csv to a collection of activ
19
19
20
20
21
21
== Real life example
22
-
22
+
23
23
In the controller where you want to export to csv, add the format.csv line (as of rails 2.1 it is not necessary to register the csv myme_type)
24
24
25
- class UserController < ApplicationController
25
+ class UserController < ApplicationController
26
26
27
- def index
28
- @users = User.all
27
+ def index
28
+ @users = User.all
29
29
30
- respond_to do |format|
31
- format.html
32
- format.xml { render :xml => @users }
33
- format.csv { send_data @users.to_csv }
34
- end
35
- end
30
+ respond_to do |format|
31
+ format.html
32
+ format.xml { render :xml => @users }
33
+ format.csv { send_data @users.to_csv }
34
+ end
35
+ end
36
36
37
- def show...
38
- def new...
39
- def edit...
40
- def create...
41
- def update...
42
- def destroy...
37
+ def show...
38
+ def new...
39
+ def edit...
40
+ def create...
41
+ def update...
42
+ def destroy...
43
43
44
- end
44
+ end
45
45
46
46
47
47
== Dependencies
48
48
49
- sudo gem install fastercsv
49
+ sudo gem install fastercsv
50
50
51
51
52
52
== Install
53
53
54
- ./script/plugin install git://github.com/arydjmal/to_csv.git
54
+ ./script/plugin install git://github.com/arydjmal/to_csv.git
55
55
56
56
57
57
== Ideas
@@ -64,5 +64,4 @@ I got ideas and influence from Mike Clarks recipe #35 in Rails Recipes book, som
64
64
Does not work on a single activerecord, ie, User.first.to_csv.
65
65
66
66
67
-
68
67
Copyright (c) 2008-2010 Ary Djmal, released under the MIT license
You can’t perform that action at this time.
0 commit comments