ruby2xlsx 0.0.1 → 0.0.2

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.
@@ -10,10 +10,13 @@ module Ruby2xlsx
10
10
  columns_names.each_with_index do |column, num|
11
11
  value = record.send(column)
12
12
 
13
- if value.is_a?(Date)
13
+ case value
14
+ when Date then
14
15
  worksheet.write_string(row, num, value.strftime("%Y-%m-%dT"), date_format)
15
- elsif value.is_a?(DateTime) || value.is_a?(Time)
16
+ when DateTime, Time then
16
17
  worksheet.write_date_time(row, num, value.strftime("%Y-%m-%dT%H:%M:%S.%L"), time_format)
18
+ when String then
19
+ worksheet.write_string(row, num, value)
17
20
  else
18
21
  worksheet.write(row, num, value)
19
22
  end
@@ -39,7 +42,7 @@ module Ruby2xlsx
39
42
  end
40
43
 
41
44
  def filename
42
- @filename ||= [(@options[:filename] || @klass.model_name.plural || "document"), ".xlsx"].join
45
+ @filename ||= [(@options[:filename] || @klass.model_name.plural || "document"), ".xls"].join
43
46
  end
44
47
 
45
48
  def each_with_index
@@ -1,3 +1,3 @@
1
1
  module Ruby2xlsx
2
- VERSION = "0.0.1".freeze
2
+ VERSION = "0.0.2".freeze
3
3
  end
data/lib/ruby2xlsx/xrb.rb CHANGED
@@ -6,7 +6,7 @@ module Ruby2xlsx
6
6
 
7
7
  def call(template)
8
8
  %{ controller.send_data ::Ruby2xlsx::Template.new(#{template.source.inspect}).render(self, assigns.merge(local_assigns)),
9
- :filename => [controller.action_name, ".xlsx"].join,
9
+ :filename => [controller.action_name, ".xls"].join,
10
10
  :type => "application/vnd.ms-excel",
11
11
  :disposition => "attachment" }
12
12
  end
@@ -0,0 +1,309 @@
1
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
2
+ Migrating to CreateArticles (20120116125427)
3
+  (0.1ms) SAVEPOINT active_record_1
4
+ SQL (50.5ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:14:38 UTC +00:00], ["title", "Some article 1"], ["updated_at", Tue, 27 Mar 2012 09:14:38 UTC +00:00]]
5
+  (0.1ms) RELEASE SAVEPOINT active_record_1
6
+  (0.0ms) SAVEPOINT active_record_1
7
+ SQL (0.3ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:14:38 UTC +00:00], ["title", "Some article 2"], ["updated_at", Tue, 27 Mar 2012 09:14:38 UTC +00:00]]
8
+  (0.0ms) RELEASE SAVEPOINT active_record_1
9
+  (0.1ms) SAVEPOINT active_record_1
10
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:14:38 UTC +00:00], ["title", "Some article 3"], ["updated_at", Tue, 27 Mar 2012 09:14:38 UTC +00:00]]
11
+  (0.0ms) RELEASE SAVEPOINT active_record_1
12
+  (0.0ms) SAVEPOINT active_record_1
13
+ SQL (0.3ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:14:38 UTC +00:00], ["title", "Some article 4"], ["updated_at", Tue, 27 Mar 2012 09:14:38 UTC +00:00]]
14
+  (0.0ms) RELEASE SAVEPOINT active_record_1
15
+  (0.1ms) SAVEPOINT active_record_1
16
+ SQL (0.4ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:14:38 UTC +00:00], ["title", "Some article 5"], ["updated_at", Tue, 27 Mar 2012 09:14:38 UTC +00:00]]
17
+  (0.1ms) RELEASE SAVEPOINT active_record_1
18
+  (0.0ms) SAVEPOINT active_record_1
19
+ SQL (0.3ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:14:38 UTC +00:00], ["title", "Some article 1"], ["updated_at", Tue, 27 Mar 2012 09:14:38 UTC +00:00]]
20
+  (0.0ms) RELEASE SAVEPOINT active_record_1
21
+  (0.0ms) SAVEPOINT active_record_1
22
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:14:38 UTC +00:00], ["title", "Some article 2"], ["updated_at", Tue, 27 Mar 2012 09:14:38 UTC +00:00]]
23
+  (0.0ms) RELEASE SAVEPOINT active_record_1
24
+  (0.0ms) SAVEPOINT active_record_1
25
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:14:38 UTC +00:00], ["title", "Some article 3"], ["updated_at", Tue, 27 Mar 2012 09:14:38 UTC +00:00]]
26
+  (0.0ms) RELEASE SAVEPOINT active_record_1
27
+  (0.0ms) SAVEPOINT active_record_1
28
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:14:38 UTC +00:00], ["title", "Some article 4"], ["updated_at", Tue, 27 Mar 2012 09:14:38 UTC +00:00]]
29
+  (0.0ms) RELEASE SAVEPOINT active_record_1
30
+  (0.0ms) SAVEPOINT active_record_1
31
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:14:38 UTC +00:00], ["title", "Some article 5"], ["updated_at", Tue, 27 Mar 2012 09:14:38 UTC +00:00]]
32
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33
+
34
+
35
+ Started GET "/another.xlsx" for 127.0.0.1 at 2012-03-27 12:14:39 +0300
36
+ Processing by ArticlesController#another as XLSX
37
+ Article Load (0.2ms) SELECT "articles".* FROM "articles" ORDER BY id DESC
38
+ Rendered text template (0.0ms)
39
+ Sent data another.xls (19.1ms)
40
+ Rendered articles/another.xlsx.xrb (355.3ms)
41
+ Completed 200 OK in 446ms (Views: 445.8ms | ActiveRecord: 0.0ms)
42
+  (0.0ms) SAVEPOINT active_record_1
43
+ SQL (0.4ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:14:39 UTC +00:00], ["title", "Some article 1"], ["updated_at", Tue, 27 Mar 2012 09:14:39 UTC +00:00]]
44
+  (0.0ms) RELEASE SAVEPOINT active_record_1
45
+  (0.0ms) SAVEPOINT active_record_1
46
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:14:39 UTC +00:00], ["title", "Some article 2"], ["updated_at", Tue, 27 Mar 2012 09:14:39 UTC +00:00]]
47
+  (0.0ms) RELEASE SAVEPOINT active_record_1
48
+  (0.0ms) SAVEPOINT active_record_1
49
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:14:39 UTC +00:00], ["title", "Some article 3"], ["updated_at", Tue, 27 Mar 2012 09:14:39 UTC +00:00]]
50
+  (0.0ms) RELEASE SAVEPOINT active_record_1
51
+  (0.0ms) SAVEPOINT active_record_1
52
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:14:39 UTC +00:00], ["title", "Some article 4"], ["updated_at", Tue, 27 Mar 2012 09:14:39 UTC +00:00]]
53
+  (0.0ms) RELEASE SAVEPOINT active_record_1
54
+  (0.0ms) SAVEPOINT active_record_1
55
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:14:39 UTC +00:00], ["title", "Some article 5"], ["updated_at", Tue, 27 Mar 2012 09:14:39 UTC +00:00]]
56
+  (0.0ms) RELEASE SAVEPOINT active_record_1
57
+
58
+
59
+ Started GET "/articles" for 127.0.0.1 at 2012-03-27 12:14:39 +0300
60
+ Processing by ArticlesController#index as HTML
61
+ Article Load (0.2ms) SELECT "articles".* FROM "articles" ORDER BY id DESC
62
+ Rendered articles/index.html.erb within layouts/application (71.9ms)
63
+ Completed 200 OK in 131ms (Views: 130.6ms | ActiveRecord: 0.2ms)
64
+
65
+
66
+ Started GET "/articles.xlsx" for 127.0.0.1 at 2012-03-27 12:14:40 +0300
67
+ Processing by ArticlesController#index as XLSX
68
+ Scoped order and limit are ignored, it's forced to be batch order and batch size
69
+ Article Load (0.2ms) SELECT "articles".* FROM "articles" WHERE ("articles"."id" >= 0) ORDER BY "articles"."id" ASC LIMIT 1000
70
+ Rendered text template (0.0ms)
71
+ Sent data articles.xls (0.5ms)
72
+ Completed 200 OK in 41ms (Views: 41.1ms | ActiveRecord: 0.0ms)
73
+  (0.0ms) SAVEPOINT active_record_1
74
+ SQL (0.4ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:14:40 UTC +00:00], ["title", "Some article 1"], ["updated_at", Tue, 27 Mar 2012 09:14:40 UTC +00:00]]
75
+  (0.0ms) RELEASE SAVEPOINT active_record_1
76
+  (0.0ms) SAVEPOINT active_record_1
77
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:14:40 UTC +00:00], ["title", "Some article 2"], ["updated_at", Tue, 27 Mar 2012 09:14:40 UTC +00:00]]
78
+  (0.0ms) RELEASE SAVEPOINT active_record_1
79
+  (0.0ms) SAVEPOINT active_record_1
80
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:14:40 UTC +00:00], ["title", "Some article 3"], ["updated_at", Tue, 27 Mar 2012 09:14:40 UTC +00:00]]
81
+  (0.0ms) RELEASE SAVEPOINT active_record_1
82
+  (0.0ms) SAVEPOINT active_record_1
83
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:14:40 UTC +00:00], ["title", "Some article 4"], ["updated_at", Tue, 27 Mar 2012 09:14:40 UTC +00:00]]
84
+  (0.0ms) RELEASE SAVEPOINT active_record_1
85
+  (0.0ms) SAVEPOINT active_record_1
86
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:14:40 UTC +00:00], ["title", "Some article 5"], ["updated_at", Tue, 27 Mar 2012 09:14:40 UTC +00:00]]
87
+  (0.0ms) RELEASE SAVEPOINT active_record_1
88
+
89
+
90
+ Started GET "/empty.xlsx" for 127.0.0.1 at 2012-03-27 12:14:40 +0300
91
+ Processing by ArticlesController#empty as XLSX
92
+ Rendered text template (0.0ms)
93
+ Sent data ruby2xlsx_defaults.xls (0.6ms)
94
+ Completed 200 OK in 29ms (Views: 28.2ms | ActiveRecord: 0.0ms)
95
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
96
+ Migrating to CreateArticles (20120116125427)
97
+  (0.1ms) SAVEPOINT active_record_1
98
+ SQL (4.5ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:17:09 UTC +00:00], ["title", "Some article 1"], ["updated_at", Tue, 27 Mar 2012 09:17:09 UTC +00:00]]
99
+  (0.1ms) RELEASE SAVEPOINT active_record_1
100
+  (0.0ms) SAVEPOINT active_record_1
101
+ SQL (0.3ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:17:09 UTC +00:00], ["title", "Some article 2"], ["updated_at", Tue, 27 Mar 2012 09:17:09 UTC +00:00]]
102
+  (0.0ms) RELEASE SAVEPOINT active_record_1
103
+  (0.0ms) SAVEPOINT active_record_1
104
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:17:09 UTC +00:00], ["title", "Some article 3"], ["updated_at", Tue, 27 Mar 2012 09:17:09 UTC +00:00]]
105
+  (0.0ms) RELEASE SAVEPOINT active_record_1
106
+  (0.0ms) SAVEPOINT active_record_1
107
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:17:09 UTC +00:00], ["title", "Some article 4"], ["updated_at", Tue, 27 Mar 2012 09:17:09 UTC +00:00]]
108
+  (0.0ms) RELEASE SAVEPOINT active_record_1
109
+  (0.0ms) SAVEPOINT active_record_1
110
+ SQL (0.3ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:17:09 UTC +00:00], ["title", "Some article 5"], ["updated_at", Tue, 27 Mar 2012 09:17:09 UTC +00:00]]
111
+  (0.0ms) RELEASE SAVEPOINT active_record_1
112
+  (0.0ms) SAVEPOINT active_record_1
113
+ SQL (0.3ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:17:09 UTC +00:00], ["title", "Some article 1"], ["updated_at", Tue, 27 Mar 2012 09:17:09 UTC +00:00]]
114
+  (0.0ms) RELEASE SAVEPOINT active_record_1
115
+  (0.0ms) SAVEPOINT active_record_1
116
+ SQL (0.3ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:17:09 UTC +00:00], ["title", "Some article 2"], ["updated_at", Tue, 27 Mar 2012 09:17:09 UTC +00:00]]
117
+  (0.0ms) RELEASE SAVEPOINT active_record_1
118
+  (0.0ms) SAVEPOINT active_record_1
119
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:17:09 UTC +00:00], ["title", "Some article 3"], ["updated_at", Tue, 27 Mar 2012 09:17:09 UTC +00:00]]
120
+  (0.0ms) RELEASE SAVEPOINT active_record_1
121
+  (0.0ms) SAVEPOINT active_record_1
122
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:17:09 UTC +00:00], ["title", "Some article 4"], ["updated_at", Tue, 27 Mar 2012 09:17:09 UTC +00:00]]
123
+  (0.0ms) RELEASE SAVEPOINT active_record_1
124
+  (0.0ms) SAVEPOINT active_record_1
125
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:17:09 UTC +00:00], ["title", "Some article 5"], ["updated_at", Tue, 27 Mar 2012 09:17:09 UTC +00:00]]
126
+  (0.0ms) RELEASE SAVEPOINT active_record_1
127
+
128
+
129
+ Started GET "/another.xlsx" for 127.0.0.1 at 2012-03-27 12:17:09 +0300
130
+ Processing by ArticlesController#another as XLSX
131
+ Article Load (0.2ms) SELECT "articles".* FROM "articles" ORDER BY id DESC
132
+ Rendered text template (0.0ms)
133
+ Sent data another.xls (2.0ms)
134
+ Rendered articles/another.xlsx.xrb (208.0ms)
135
+ Completed 200 OK in 247ms (Views: 246.8ms | ActiveRecord: 0.0ms)
136
+  (0.0ms) SAVEPOINT active_record_1
137
+ SQL (0.4ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:17:09 UTC +00:00], ["title", "Some article 1"], ["updated_at", Tue, 27 Mar 2012 09:17:09 UTC +00:00]]
138
+  (0.0ms) RELEASE SAVEPOINT active_record_1
139
+  (0.0ms) SAVEPOINT active_record_1
140
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:17:09 UTC +00:00], ["title", "Some article 2"], ["updated_at", Tue, 27 Mar 2012 09:17:09 UTC +00:00]]
141
+  (0.0ms) RELEASE SAVEPOINT active_record_1
142
+  (0.0ms) SAVEPOINT active_record_1
143
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:17:09 UTC +00:00], ["title", "Some article 3"], ["updated_at", Tue, 27 Mar 2012 09:17:09 UTC +00:00]]
144
+  (0.0ms) RELEASE SAVEPOINT active_record_1
145
+  (0.0ms) SAVEPOINT active_record_1
146
+ SQL (1.0ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:17:09 UTC +00:00], ["title", "Some article 4"], ["updated_at", Tue, 27 Mar 2012 09:17:09 UTC +00:00]]
147
+  (0.0ms) RELEASE SAVEPOINT active_record_1
148
+  (0.0ms) SAVEPOINT active_record_1
149
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:17:09 UTC +00:00], ["title", "Some article 5"], ["updated_at", Tue, 27 Mar 2012 09:17:09 UTC +00:00]]
150
+  (0.0ms) RELEASE SAVEPOINT active_record_1
151
+
152
+
153
+ Started GET "/articles" for 127.0.0.1 at 2012-03-27 12:17:09 +0300
154
+ Processing by ArticlesController#index as HTML
155
+ Article Load (0.2ms) SELECT "articles".* FROM "articles" ORDER BY id DESC
156
+ Rendered articles/index.html.erb within layouts/application (44.0ms)
157
+ Completed 200 OK in 47ms (Views: 46.2ms | ActiveRecord: 0.2ms)
158
+
159
+
160
+ Started GET "/articles.xlsx" for 127.0.0.1 at 2012-03-27 12:17:10 +0300
161
+ Processing by ArticlesController#index as XLSX
162
+ Scoped order and limit are ignored, it's forced to be batch order and batch size
163
+ Article Load (0.2ms) SELECT "articles".* FROM "articles" WHERE ("articles"."id" >= 0) ORDER BY "articles"."id" ASC LIMIT 1000
164
+ Rendered text template (0.0ms)
165
+ Sent data articles.xls (0.5ms)
166
+ Completed 200 OK in 41ms (Views: 41.2ms | ActiveRecord: 0.0ms)
167
+  (0.0ms) SAVEPOINT active_record_1
168
+ SQL (0.4ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:17:10 UTC +00:00], ["title", "Some article 1"], ["updated_at", Tue, 27 Mar 2012 09:17:10 UTC +00:00]]
169
+  (0.0ms) RELEASE SAVEPOINT active_record_1
170
+  (0.0ms) SAVEPOINT active_record_1
171
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:17:10 UTC +00:00], ["title", "Some article 2"], ["updated_at", Tue, 27 Mar 2012 09:17:10 UTC +00:00]]
172
+  (0.0ms) RELEASE SAVEPOINT active_record_1
173
+  (0.0ms) SAVEPOINT active_record_1
174
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:17:10 UTC +00:00], ["title", "Some article 3"], ["updated_at", Tue, 27 Mar 2012 09:17:10 UTC +00:00]]
175
+  (0.0ms) RELEASE SAVEPOINT active_record_1
176
+  (0.0ms) SAVEPOINT active_record_1
177
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:17:10 UTC +00:00], ["title", "Some article 4"], ["updated_at", Tue, 27 Mar 2012 09:17:10 UTC +00:00]]
178
+  (0.0ms) RELEASE SAVEPOINT active_record_1
179
+  (0.0ms) SAVEPOINT active_record_1
180
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:17:10 UTC +00:00], ["title", "Some article 5"], ["updated_at", Tue, 27 Mar 2012 09:17:10 UTC +00:00]]
181
+  (0.0ms) RELEASE SAVEPOINT active_record_1
182
+
183
+
184
+ Started GET "/empty.xlsx" for 127.0.0.1 at 2012-03-27 12:17:10 +0300
185
+ Processing by ArticlesController#empty as XLSX
186
+ Rendered text template (0.0ms)
187
+ Sent data ruby2xlsx_defaults.xls (0.5ms)
188
+ Completed 200 OK in 8ms (Views: 7.3ms | ActiveRecord: 0.0ms)
189
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
190
+ Migrating to CreateArticles (20120116125427)
191
+  (0.1ms) SAVEPOINT active_record_1
192
+ SQL (4.5ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:20:03 UTC +00:00], ["title", "Some article 1"], ["updated_at", Tue, 27 Mar 2012 09:20:03 UTC +00:00]]
193
+  (0.1ms) RELEASE SAVEPOINT active_record_1
194
+  (0.0ms) SAVEPOINT active_record_1
195
+ SQL (0.3ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:20:03 UTC +00:00], ["title", "Some article 2"], ["updated_at", Tue, 27 Mar 2012 09:20:03 UTC +00:00]]
196
+  (0.0ms) RELEASE SAVEPOINT active_record_1
197
+  (0.0ms) SAVEPOINT active_record_1
198
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:20:03 UTC +00:00], ["title", "Some article 3"], ["updated_at", Tue, 27 Mar 2012 09:20:03 UTC +00:00]]
199
+  (0.0ms) RELEASE SAVEPOINT active_record_1
200
+  (0.0ms) SAVEPOINT active_record_1
201
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:20:03 UTC +00:00], ["title", "Some article 4"], ["updated_at", Tue, 27 Mar 2012 09:20:03 UTC +00:00]]
202
+  (0.0ms) RELEASE SAVEPOINT active_record_1
203
+  (0.0ms) SAVEPOINT active_record_1
204
+ SQL (0.3ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:20:03 UTC +00:00], ["title", "Some article 5"], ["updated_at", Tue, 27 Mar 2012 09:20:03 UTC +00:00]]
205
+  (0.1ms) RELEASE SAVEPOINT active_record_1
206
+  (0.0ms) SAVEPOINT active_record_1
207
+ SQL (0.4ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:20:03 UTC +00:00], ["title", "(\")\")"], ["updated_at", Tue, 27 Mar 2012 09:20:03 UTC +00:00]]
208
+  (0.1ms) RELEASE SAVEPOINT active_record_1
209
+
210
+
211
+ Started GET "/articles.xlsx" for 127.0.0.1 at 2012-03-27 12:20:04 +0300
212
+ Processing by ArticlesController#index as XLSX
213
+ Scoped order and limit are ignored, it's forced to be batch order and batch size
214
+ Article Load (0.2ms) SELECT "articles".* FROM "articles" WHERE ("articles"."id" >= 0) ORDER BY "articles"."id" ASC LIMIT 1000
215
+ Rendered text template (0.0ms)
216
+ Sent data articles.xls (39.3ms)
217
+ Completed 200 OK in 239ms (Views: 238.5ms | ActiveRecord: 0.0ms)
218
+  (0.0ms) SAVEPOINT active_record_1
219
+ SQL (0.4ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00], ["title", "Some article 1"], ["updated_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00]]
220
+  (0.0ms) RELEASE SAVEPOINT active_record_1
221
+  (0.0ms) SAVEPOINT active_record_1
222
+ SQL (0.3ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00], ["title", "Some article 2"], ["updated_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00]]
223
+  (0.0ms) RELEASE SAVEPOINT active_record_1
224
+  (0.0ms) SAVEPOINT active_record_1
225
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00], ["title", "Some article 3"], ["updated_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00]]
226
+  (0.0ms) RELEASE SAVEPOINT active_record_1
227
+  (0.0ms) SAVEPOINT active_record_1
228
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00], ["title", "Some article 4"], ["updated_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00]]
229
+  (0.0ms) RELEASE SAVEPOINT active_record_1
230
+  (0.0ms) SAVEPOINT active_record_1
231
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00], ["title", "Some article 5"], ["updated_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00]]
232
+  (0.0ms) RELEASE SAVEPOINT active_record_1
233
+  (0.0ms) SAVEPOINT active_record_1
234
+ SQL (0.3ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00], ["title", "Some article 1"], ["updated_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00]]
235
+  (0.0ms) RELEASE SAVEPOINT active_record_1
236
+  (0.0ms) SAVEPOINT active_record_1
237
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00], ["title", "Some article 2"], ["updated_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00]]
238
+  (0.0ms) RELEASE SAVEPOINT active_record_1
239
+  (0.0ms) SAVEPOINT active_record_1
240
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00], ["title", "Some article 3"], ["updated_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00]]
241
+  (0.0ms) RELEASE SAVEPOINT active_record_1
242
+  (0.0ms) SAVEPOINT active_record_1
243
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00], ["title", "Some article 4"], ["updated_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00]]
244
+  (0.0ms) RELEASE SAVEPOINT active_record_1
245
+  (0.0ms) SAVEPOINT active_record_1
246
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00], ["title", "Some article 5"], ["updated_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00]]
247
+  (0.0ms) RELEASE SAVEPOINT active_record_1
248
+
249
+
250
+ Started GET "/another.xlsx" for 127.0.0.1 at 2012-03-27 12:20:04 +0300
251
+ Processing by ArticlesController#another as XLSX
252
+ Article Load (0.2ms) SELECT "articles".* FROM "articles" ORDER BY id DESC
253
+ Rendered text template (0.0ms)
254
+ Sent data another.xls (0.6ms)
255
+ Rendered articles/another.xlsx.xrb (46.0ms)
256
+ Completed 200 OK in 47ms (Views: 46.8ms | ActiveRecord: 0.0ms)
257
+  (0.0ms) SAVEPOINT active_record_1
258
+ SQL (0.4ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00], ["title", "Some article 1"], ["updated_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00]]
259
+  (0.0ms) RELEASE SAVEPOINT active_record_1
260
+  (0.0ms) SAVEPOINT active_record_1
261
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00], ["title", "Some article 2"], ["updated_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00]]
262
+  (0.0ms) RELEASE SAVEPOINT active_record_1
263
+  (0.0ms) SAVEPOINT active_record_1
264
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00], ["title", "Some article 3"], ["updated_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00]]
265
+  (0.0ms) RELEASE SAVEPOINT active_record_1
266
+  (0.0ms) SAVEPOINT active_record_1
267
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00], ["title", "Some article 4"], ["updated_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00]]
268
+  (0.0ms) RELEASE SAVEPOINT active_record_1
269
+  (0.0ms) SAVEPOINT active_record_1
270
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00], ["title", "Some article 5"], ["updated_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00]]
271
+  (0.0ms) RELEASE SAVEPOINT active_record_1
272
+
273
+
274
+ Started GET "/articles" for 127.0.0.1 at 2012-03-27 12:20:04 +0300
275
+ Processing by ArticlesController#index as HTML
276
+ Article Load (0.2ms) SELECT "articles".* FROM "articles" ORDER BY id DESC
277
+ Rendered articles/index.html.erb within layouts/application (12.3ms)
278
+ Completed 200 OK in 15ms (Views: 14.4ms | ActiveRecord: 0.2ms)
279
+
280
+
281
+ Started GET "/articles.xlsx" for 127.0.0.1 at 2012-03-27 12:20:04 +0300
282
+ Processing by ArticlesController#index as XLSX
283
+ Scoped order and limit are ignored, it's forced to be batch order and batch size
284
+ Article Load (0.2ms) SELECT "articles".* FROM "articles" WHERE ("articles"."id" >= 0) ORDER BY "articles"."id" ASC LIMIT 1000
285
+ Rendered text template (0.0ms)
286
+ Sent data articles.xls (0.5ms)
287
+ Completed 200 OK in 9ms (Views: 9.1ms | ActiveRecord: 0.0ms)
288
+  (0.0ms) SAVEPOINT active_record_1
289
+ SQL (0.4ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00], ["title", "Some article 1"], ["updated_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00]]
290
+  (0.0ms) RELEASE SAVEPOINT active_record_1
291
+  (0.0ms) SAVEPOINT active_record_1
292
+ SQL (0.3ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00], ["title", "Some article 2"], ["updated_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00]]
293
+  (0.0ms) RELEASE SAVEPOINT active_record_1
294
+  (0.0ms) SAVEPOINT active_record_1
295
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00], ["title", "Some article 3"], ["updated_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00]]
296
+  (0.0ms) RELEASE SAVEPOINT active_record_1
297
+  (0.0ms) SAVEPOINT active_record_1
298
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00], ["title", "Some article 4"], ["updated_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00]]
299
+  (0.0ms) RELEASE SAVEPOINT active_record_1
300
+  (0.0ms) SAVEPOINT active_record_1
301
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", nil], ["created_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00], ["title", "Some article 5"], ["updated_at", Tue, 27 Mar 2012 09:20:04 UTC +00:00]]
302
+  (0.0ms) RELEASE SAVEPOINT active_record_1
303
+
304
+
305
+ Started GET "/empty.xlsx" for 127.0.0.1 at 2012-03-27 12:20:04 +0300
306
+ Processing by ArticlesController#empty as XLSX
307
+ Rendered text template (0.0ms)
308
+ Sent data ruby2xlsx_defaults.xls (0.6ms)
309
+ Completed 200 OK in 38ms (Views: 38.0ms | ActiveRecord: 0.0ms)
@@ -17,7 +17,7 @@ class NavigationTest < ActiveSupport::IntegrationCase
17
17
  click_link 'Excel'
18
18
 
19
19
  assert_equal 'binary', headers['Content-Transfer-Encoding']
20
- assert_equal 'attachment; filename="articles.xlsx"', headers['Content-Disposition']
20
+ assert_equal 'attachment; filename="articles.xls"', headers['Content-Disposition']
21
21
  assert_equal 'application/vnd.ms-excel', headers['Content-Type']
22
22
  end
23
23
 
@@ -25,7 +25,7 @@ class NavigationTest < ActiveSupport::IntegrationCase
25
25
  visit '/another.xlsx'
26
26
 
27
27
  assert_equal 'binary', headers['Content-Transfer-Encoding']
28
- assert_equal 'attachment; filename="another.xlsx"', headers['Content-Disposition']
28
+ assert_equal 'attachment; filename="another.xls"', headers['Content-Disposition']
29
29
  assert_equal 'application/vnd.ms-excel', headers['Content-Type']
30
30
  end
31
31
 
@@ -33,7 +33,17 @@ class NavigationTest < ActiveSupport::IntegrationCase
33
33
  visit '/empty.xlsx'
34
34
 
35
35
  assert_equal 'binary', headers['Content-Transfer-Encoding']
36
- assert_equal 'attachment; filename="ruby2xlsx_defaults.xlsx"', headers['Content-Disposition']
36
+ assert_equal 'attachment; filename="ruby2xlsx_defaults.xls"', headers['Content-Disposition']
37
+ assert_equal 'application/vnd.ms-excel', headers['Content-Type']
38
+ end
39
+
40
+ test 'should encode special charsets' do
41
+ Article.create(:title => '(")")')
42
+
43
+ visit '/articles.xlsx'
44
+
45
+ assert_equal 'binary', headers['Content-Transfer-Encoding']
46
+ assert_equal 'attachment; filename="articles.xls"', headers['Content-Disposition']
37
47
  assert_equal 'application/vnd.ms-excel', headers['Content-Type']
38
48
  end
39
49
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby2xlsx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-16 00:00:00.000000000 Z
12
+ date: 2012-03-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: writeexcel
16
- requirement: &71376690 !ruby/object:Gem::Requirement
16
+ requirement: &85238090 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.6.12
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *71376690
24
+ version_requirements: *85238090
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activemodel
27
- requirement: &71376370 !ruby/object:Gem::Requirement
27
+ requirement: &85237880 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *71376370
35
+ version_requirements: *85237880
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: sqlite3
38
- requirement: &71376060 !ruby/object:Gem::Requirement
38
+ requirement: &85237650 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *71376060
46
+ version_requirements: *85237650
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: capybara
49
- requirement: &71375600 !ruby/object:Gem::Requirement
49
+ requirement: &85237400 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: 1.1.2
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *71375600
57
+ version_requirements: *85237400
58
58
  description: Another gem for exporting data to Excel
59
59
  email:
60
60
  - galeta.igor@gmail.com
@@ -97,6 +97,7 @@ files:
97
97
  - test/dummy/app/assets/javascripts/application.js
98
98
  - test/dummy/app/controllers/application_controller.rb
99
99
  - test/dummy/app/controllers/articles_controller.rb
100
+ - test/dummy/log/test.log
100
101
  - test/dummy/Rakefile
101
102
  - test/dummy/script/rails
102
103
  - test/dummy/config/routes.rb
@@ -168,6 +169,7 @@ test_files:
168
169
  - test/dummy/app/assets/javascripts/application.js
169
170
  - test/dummy/app/controllers/application_controller.rb
170
171
  - test/dummy/app/controllers/articles_controller.rb
172
+ - test/dummy/log/test.log
171
173
  - test/dummy/Rakefile
172
174
  - test/dummy/script/rails
173
175
  - test/dummy/config/routes.rb