acts_as_xlsx 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,91 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
- <head>
5
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
- <title>
7
- File: LICENSE
8
-
9
- &mdash; acts_as_xlsx: a rails plug in for axlsx
10
-
11
- </title>
12
-
13
- <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
14
-
15
- <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
16
-
17
- <script type="text/javascript" charset="utf-8">
18
- relpath = '';
19
- if (relpath != '') relpath += '/';
20
- </script>
21
-
22
- <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
23
-
24
- <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
25
-
26
-
27
- </head>
28
- <body>
29
- <script type="text/javascript" charset="utf-8">
30
- if (window.top.frames.main) document.body.className = 'frames';
31
- </script>
32
-
33
- <div id="header">
34
- <div id="menu">
35
-
36
- <a href="_index.html" title="Index">Index</a> &raquo;
37
- <span class="title">File: LICENSE</span>
38
-
39
-
40
- <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
- </div>
42
-
43
- <div id="search">
44
-
45
- <a id="class_list_link" href="#">Class List</a>
46
-
47
- <a id="method_list_link" href="#">Method List</a>
48
-
49
- <a id="file_list_link" href="#">File List</a>
50
-
51
- </div>
52
- <div class="clear"></div>
53
- </div>
54
-
55
- <iframe id="search_frame"></iframe>
56
-
57
- <div id="content"><div id='filecontents'><p>
58
- Copyright &#169; 2011 Randy Morgan
59
- </p>
60
- <p>
61
- Permission is hereby granted, free of charge, to any person obtaining a
62
- copy of this software and associated documentation files (the
63
- &quot;Software&quot;), to deal in the Software without restriction,
64
- including without limitation the rights to use, copy, modify, merge,
65
- publish, distribute, sublicense, and/or sell copies of the Software, and to
66
- permit persons to whom the Software is furnished to do so, subject to the
67
- following conditions:
68
- </p>
69
- <p>
70
- The above copyright notice and this permission notice shall be included in
71
- all copies or substantial portions of the Software.
72
- </p>
73
- <p>
74
- THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
75
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
76
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
77
- NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
78
- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
79
- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
80
- USE OR OTHER DEALINGS IN THE SOFTWARE.
81
- </p>
82
- </div></div>
83
-
84
- <div id="footer">
85
- Generated on Tue Dec 6 18:49:18 2011 by
86
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
87
- 0.7.4 (ruby-1.8.7).
88
- </div>
89
-
90
- </body>
91
- </html>
@@ -1,217 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
- <head>
5
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
- <title>
7
- File: README
8
-
9
- &mdash; acts_as_xlsx: a rails plug in for axlsx
10
-
11
- </title>
12
-
13
- <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
14
-
15
- <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
16
-
17
- <script type="text/javascript" charset="utf-8">
18
- relpath = '';
19
- if (relpath != '') relpath += '/';
20
- </script>
21
-
22
- <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
23
-
24
- <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
25
-
26
-
27
- </head>
28
- <body>
29
- <script type="text/javascript" charset="utf-8">
30
- if (window.top.frames.main) document.body.className = 'frames';
31
- </script>
32
-
33
- <div id="header">
34
- <div id="menu">
35
-
36
- <a href="_index.html" title="Index">Index</a> &raquo;
37
- <span class="title">File: README</span>
38
-
39
-
40
- <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
- </div>
42
-
43
- <div id="search">
44
-
45
- <a id="class_list_link" href="#">Class List</a>
46
-
47
- <a id="method_list_link" href="#">Method List</a>
48
-
49
- <a id="file_list_link" href="#">File List</a>
50
-
51
- </div>
52
- <div class="clear"></div>
53
- </div>
54
-
55
- <iframe id="search_frame"></iframe>
56
-
57
- <div id="content"><div id='filecontents'><h1>Acts as xlsx: Office Open XML Spreadsheet Generation plugin for active record</h1>
58
-
59
- <p><a href="http://travis-ci.org/randym/acts_as_xlsx/"><img src="https://secure.travis-ci.org/randym/acts_as_xlsx.png" alt="Build Status" /></a></p>
60
-
61
- <p><strong>IRC</strong>: <a href="irc://irc.freenode.net/axlsx">irc.freenode.net / #axlsx</a> <br/>
62
- <strong>Git</strong>: <a href="http://github.com/randym/acts_as_xlsx">http://github.com/randym/acts_as_xlsx</a> <br/>
63
- <strong>Author</strong>: Randy Morgan <br/>
64
- <strong>Copyright</strong>: 2011 <br/>
65
- <strong>License</strong>: MIT License <br/>
66
- <strong>Latest Version</strong>: 1.0.3 <br/>
67
- <strong>Ruby Version</strong>: 1.8.7 - 1.9.3<br/>
68
- <strong>Release Date</strong>: December 6th 2011</p>
69
-
70
- <h2>Synopsis</h2>
71
-
72
- <p>Acts_as_xlsx is an active record plugin for Axlsx. It makes generating excel spreadsheets from any subclass of ActiveRecord::Base as simple as a couple of lines of code.</p>
73
-
74
- <h2>Feature List</h2>
75
-
76
- <p>**1. Mixes into active record base to provide to_xlsx</p>
77
-
78
- <p>**2. Can work at the end of any series of finder methods.</p>
79
-
80
- <p>**3. Can accept any set of find options</p>
81
-
82
- <p>**4. Automates localization of column heading with i18n support</p>
83
-
84
- <p>**5. Lets you specify columns and methods chains you want to call to populate your table in one go.</p>
85
-
86
- <p>**6. Gives you access to the axlsx package so you can add styles, charts and pictures to satisfy those flashy sales guys.</p>
87
-
88
- <p>**7. Plays nicely with both ruby 1.8.7 + rails 2.3 as well as ruby 1.9.3 + rails 3</p>
89
-
90
- <p>**8. Automatically registers xlsx Mime type for use in respond_to web-service support.</p>
91
-
92
- <h2>Installing</h2>
93
-
94
- <p>To install, use the following command:</p>
95
-
96
- <pre class="code">$ <span class='rubyid_gem identifier id'>gem</span> <span class='rubyid_install identifier id'>install</span> <span class='rubyid_acts_as_xlsx identifier id'>acts_as_xlsx</span>
97
- </pre>
98
-
99
- <h2>Usage</h2>
100
-
101
- <h3>Examples</h3>
102
-
103
- <p>Also see the writeups here:
104
- <a href="http://axlsx.blogspot.com/">http://axlsx.blogspot.com/</a></p>
105
-
106
- <p>A trivial rails example. In a production environment you will want to you stuff like x_sendfile and Tempfile<br/>
107
- <a href="http://www.therailsway.com/2009/2/22/file-downloads-done-right">http://www.therailsway.com/2009/2/22/file-downloads-done-right</a></p>
108
-
109
- <p>for nginx<br/>
110
- <a href="http://andrewtimberlake.com/blog/how-to-protect-downloads-but-still-have-nginx-serve-the-files">http://andrewtimberlake.com/blog/how-to-protect-downloads-but-still-have-nginx-serve-the-files</a></p>
111
-
112
- <pre class="code"> <span class='comment val'>#Add the gem to your Gemfile and bundle install</span>
113
- <span class='rubyid_gem identifier id'>gem</span> <span class='string val'>'acts_as_xlsx'</span>
114
-
115
- <span class='comment val'># app/models/post.rb</span>
116
- <span class='rubyid_class class kw'>class</span> <span class='rubyid_Post constant id'>Post</span> <span class='lt op'>&lt;</span> <span class='rubyid_ActiveRecord constant id'>ActiveRecord</span><span class='colon2 op'>::</span><span class='rubyid_Base constant id'>Base</span>
117
- <span class='rubyid_acts_as_xlsx identifier id'>acts_as_xlsx</span>
118
- <span class='rubyid_end end kw'>end</span>
119
-
120
- <span class='comment val'># app/controllers/posts_controller.rb</span>
121
- <span class='rubyid_class class kw'>class</span> <span class='rubyid_PostsController constant id'>PostsController</span> <span class='lt op'>&lt;</span> <span class='rubyid_ApplicationController constant id'>ApplicationController</span>
122
- <span class='comment val'># GET posts/xlsx </span>
123
- <span class='rubyid_def def kw'>def</span> <span class='rubyid_xlsx identifier id'>xlsx</span>
124
- <span class='rubyid_p identifier id'>p</span> <span class='assign token'>=</span> <span class='rubyid_Post constant id'>Post</span><span class='dot token'>.</span><span class='rubyid_to_xlsx identifier id'>to_xlsx</span>
125
- <span class='rubyid_p identifier id'>p</span><span class='dot token'>.</span><span class='rubyid_serialize identifier id'>serialize</span><span class='lparen token'>(</span><span class='string val'>'public/downloads/posts.xlsx'</span><span class='rparen token'>)</span>
126
- <span class='rubyid_send_file identifier id'>send_file</span> <span class='string val'>'public/downloads/posts.xlsx'</span><span class='comma token'>,</span> <span class='symbol val'>:type=</span><span class='gt op'>&gt;</span><span class='string val'>&quot;application/xlsx&quot;</span>
127
- <span class='rubyid_end end kw'>end</span>
128
- <span class='rubyid_end end kw'>end</span>
129
-
130
- <span class='comment val'># dont forget to add posts/xslx to your routes!</span>
131
- </pre>
132
-
133
- <p>In addition to dumping the entire table, it is also possible to specify the columns and method chains to execute in genrating your report.</p>
134
-
135
- <pre class="code"> <span class='comment val'># GET posts/xslx</span>
136
- <span class='rubyid_def def kw'>def</span> <span class='rubyid_xlsx identifier id'>xlsx</span>
137
- <span class='rubyid_p identifier id'>p</span> <span class='assign token'>=</span> <span class='rubyid_Post constant id'>Post</span><span class='dot token'>.</span><span class='rubyid_to_xlsx identifier id'>to_xlsx</span> <span class='symbol val'>:columns</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='lbrack token'>[</span><span class='symbol val'>:name</span><span class='comma token'>,</span> <span class='symbol val'>:title</span><span class='comma token'>,</span> <span class='symbol val'>:ranking</span><span class='comma token'>,</span> <span class='symbol val'>:'comments.last.content'</span><span class='comma token'>,</span> <span class='symbol val'>:'comments.last.author.name'</span><span class='rbrack token'>]</span>
138
- <span class='rubyid_p identifier id'>p</span><span class='dot token'>.</span><span class='rubyid_serialize identifier id'>serialize</span><span class='lparen token'>(</span><span class='string val'>'public/downloads/posts.xlsx'</span><span class='rparen token'>)</span>
139
- <span class='rubyid_send_file identifier id'>send_file</span> <span class='string val'>'public/downloads/posts.xlsx'</span><span class='comma token'>,</span> <span class='symbol val'>:type=</span><span class='gt op'>&gt;</span><span class='string val'>&quot;application/xlsx&quot;</span>
140
- <span class='rubyid_end end kw'>end</span>
141
- </pre>
142
-
143
- <p>If your application uses i18n, you can specify the prefix for column labels as well</p>
144
-
145
- <pre class="code"> <span class='comment val'># GET posts/xslx</span>
146
- <span class='rubyid_def def kw'>def</span> <span class='rubyid_xlsx identifier id'>xlsx</span>
147
- <span class='rubyid_p identifier id'>p</span> <span class='assign token'>=</span> <span class='rubyid_Post constant id'>Post</span><span class='dot token'>.</span><span class='rubyid_to_xlsx identifier id'>to_xlsx</span> <span class='symbol val'>:i18n</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='string val'>'activerecord.attributes'</span>
148
- <span class='rubyid_p identifier id'>p</span><span class='dot token'>.</span><span class='rubyid_serialize identifier id'>serialize</span><span class='lparen token'>(</span><span class='string val'>'public/downloads/posts.xlsx'</span><span class='rparen token'>)</span>
149
- <span class='rubyid_send_file identifier id'>send_file</span> <span class='string val'>'public/downloads/posts.xlsx'</span><span class='comma token'>,</span> <span class='symbol val'>:type=</span><span class='gt op'>&gt;</span><span class='string val'>&quot;application/xlsx&quot;</span>
150
- <span class='rubyid_end end kw'>end</span>
151
- </pre>
152
-
153
- <p>For examples on how to use axlsx for custom styles, charts, images and more see:</p>
154
-
155
- <pre class="code"> <span class='lbrack token'>[</span><span class='rubyid_http identifier id'>http</span><span class='symbol val'>:/</span><span class='regexp val'>/rubygems.org/</span><span class='rubyid_gems identifier id'>gems</span><span class='div op'>/</span><span class='rubyid_axlsx identifier id'>axlsx</span><span class='rbrack token'>]</span> <span class='lparen token'>(</span><span class='rubyid_https identifier id'>https</span><span class='symbol val'>:/</span><span class='regexp val'>/rubygems.org/</span><span class='rubyid_gems identifier id'>gems</span><span class='div op'>/</span><span class='rubyid_axlsx identifier id'>axlsx</span><span class='rparen token'>)</span>
156
- </pre>
157
-
158
- <h3>Documentation</h3>
159
-
160
- <p>This gem is 100% documented with YARD, an exceptional documentation library. To see documentation for this, and all the gems installed on your system use:</p>
161
-
162
- <pre class="code"> <span class='rubyid_gem identifier id'>gem</span> <span class='rubyid_install identifier id'>install</span> <span class='rubyid_yard identifier id'>yard</span>
163
- <span class='rubyid_yard identifier id'>yard</span> <span class='rubyid_server identifier id'>server</span> <span class='minus op'>-</span><span class='rubyid_g identifier id'>g</span>
164
- </pre>
165
-
166
- <h3>Specs</h3>
167
-
168
- <p>This gem has 100% coverage using Test::Unit</p>
169
-
170
- <h2>Changelog</h2>
171
-
172
- <ul>
173
- <li><p><strong>December.6.11</strong>: 1.0.3 release</p>
174
-
175
- <ul>
176
- <li>Added Mime type definition for rails to support respond_to |format| style handling in controllers.</li>
177
- </ul>
178
- </li>
179
- <li><p><strong>December.3.11</strong>: 1.0.2 release
180
- Added support for chained method columns like :'model.association.attribute'</p></li>
181
- <li><p><strong>October.30.11</strong>: 1.0.1 release</p>
182
-
183
- <ul>
184
- <li>Patch for inclusion error</li>
185
- </ul>
186
- </li>
187
- <li><p><strong>October.30.11</strong>: 1.0.0 release</p>
188
-
189
- <ul>
190
- <li>First release</li>
191
- </ul>
192
- </li>
193
- <li><p><strong>October.30.11</strong>: 1.0.0a release</p>
194
-
195
- <ul>
196
- <li>First pre release</li>
197
- </ul>
198
- </li>
199
- </ul>
200
-
201
-
202
- <p>Please see the <a href="file.CHANGELOG.html" title="CHANGELOG">CHANGELOG</a> document for past release information.</p>
203
-
204
- <h2>Copyright</h2>
205
-
206
- <p>Acts_as_xlsx &copy; 2011 by <a href="mailto:digial.ipseity@gmail.com">Randy Morgan</a>. Acts_as_xlsx is
207
- licensed under the MIT license. Please see the <a href="file.LICENSE.html" title="LICENSE">LICENSE</a> document for more information.</p>
208
- </div></div>
209
-
210
- <div id="footer">
211
- Generated on Tue Dec 6 18:49:18 2011 by
212
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
213
- 0.7.4 (ruby-1.8.7).
214
- </div>
215
-
216
- </body>
217
- </html>
@@ -1,55 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html>
4
- <head>
5
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
-
7
- <link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
8
-
9
- <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
10
-
11
-
12
-
13
- <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
14
-
15
- <script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
16
-
17
-
18
- <base id="base_target" target="_parent" />
19
- </head>
20
- <body>
21
- <script type="text/javascript" charset="utf-8">
22
- if (window.top.frames.main) {
23
- document.getElementById('base_target').target = 'main';
24
- document.body.className = 'frames';
25
- }
26
- </script>
27
- <div id="content">
28
- <h1 id="full_list_header">File List</h1>
29
- <div id="nav">
30
-
31
- <a target="_self" href="class_list.html">Classes</a>
32
-
33
- <a target="_self" href="method_list.html">Methods</a>
34
-
35
- <a target="_self" href="file_list.html">Files</a>
36
-
37
- </div>
38
- <div id="search">Search: <input type="text" /></div>
39
-
40
- <ul id="full_list" class="files">
41
-
42
-
43
- <li class="r1"><a href="index.html" title="README">README</a></li>
44
-
45
-
46
- <li class="r2"><a href="file.LICENSE.html" title="LICENSE">LICENSE</a></li>
47
-
48
-
49
- <li class="r1"><a href="file.CHANGELOG.html" title="CHANGELOG">CHANGELOG</a></li>
50
-
51
-
52
- </ul>
53
- </div>
54
- </body>
55
- </html>
@@ -1,13 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
3
-
4
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
- <head>
6
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7
- <title>acts_as_xlsx: a rails plug in for axlsx</title>
8
- </head>
9
- <frameset cols="20%,*">
10
- <frame name="list" src="class_list.html" />
11
- <frame name="main" src="index.html" />
12
- </frameset>
13
- </html>
@@ -1,217 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
- <head>
5
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
- <title>
7
- File: README
8
-
9
- &mdash; acts_as_xlsx: a rails plug in for axlsx
10
-
11
- </title>
12
-
13
- <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
14
-
15
- <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
16
-
17
- <script type="text/javascript" charset="utf-8">
18
- relpath = '';
19
- if (relpath != '') relpath += '/';
20
- </script>
21
-
22
- <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
23
-
24
- <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
25
-
26
-
27
- </head>
28
- <body>
29
- <script type="text/javascript" charset="utf-8">
30
- if (window.top.frames.main) document.body.className = 'frames';
31
- </script>
32
-
33
- <div id="header">
34
- <div id="menu">
35
-
36
- <a href="_index.html" title="Index">Index</a> &raquo;
37
- <span class="title">File: README</span>
38
-
39
-
40
- <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
- </div>
42
-
43
- <div id="search">
44
-
45
- <a id="class_list_link" href="#">Class List</a>
46
-
47
- <a id="method_list_link" href="#">Method List</a>
48
-
49
- <a id="file_list_link" href="#">File List</a>
50
-
51
- </div>
52
- <div class="clear"></div>
53
- </div>
54
-
55
- <iframe id="search_frame"></iframe>
56
-
57
- <div id="content"><div id='filecontents'><h1>Acts as xlsx: Office Open XML Spreadsheet Generation plugin for active record</h1>
58
-
59
- <p><a href="http://travis-ci.org/randym/acts_as_xlsx/"><img src="https://secure.travis-ci.org/randym/acts_as_xlsx.png" alt="Build Status" /></a></p>
60
-
61
- <p><strong>IRC</strong>: <a href="irc://irc.freenode.net/axlsx">irc.freenode.net / #axlsx</a> <br/>
62
- <strong>Git</strong>: <a href="http://github.com/randym/acts_as_xlsx">http://github.com/randym/acts_as_xlsx</a> <br/>
63
- <strong>Author</strong>: Randy Morgan <br/>
64
- <strong>Copyright</strong>: 2011 <br/>
65
- <strong>License</strong>: MIT License <br/>
66
- <strong>Latest Version</strong>: 1.0.3 <br/>
67
- <strong>Ruby Version</strong>: 1.8.7 - 1.9.3<br/>
68
- <strong>Release Date</strong>: December 6th 2011</p>
69
-
70
- <h2>Synopsis</h2>
71
-
72
- <p>Acts_as_xlsx is an active record plugin for Axlsx. It makes generating excel spreadsheets from any subclass of ActiveRecord::Base as simple as a couple of lines of code.</p>
73
-
74
- <h2>Feature List</h2>
75
-
76
- <p>**1. Mixes into active record base to provide to_xlsx</p>
77
-
78
- <p>**2. Can work at the end of any series of finder methods.</p>
79
-
80
- <p>**3. Can accept any set of find options</p>
81
-
82
- <p>**4. Automates localization of column heading with i18n support</p>
83
-
84
- <p>**5. Lets you specify columns and methods chains you want to call to populate your table in one go.</p>
85
-
86
- <p>**6. Gives you access to the axlsx package so you can add styles, charts and pictures to satisfy those flashy sales guys.</p>
87
-
88
- <p>**7. Plays nicely with both ruby 1.8.7 + rails 2.3 as well as ruby 1.9.3 + rails 3</p>
89
-
90
- <p>**8. Automatically registers xlsx Mime type for use in respond_to web-service support.</p>
91
-
92
- <h2>Installing</h2>
93
-
94
- <p>To install, use the following command:</p>
95
-
96
- <pre class="code">$ <span class='rubyid_gem identifier id'>gem</span> <span class='rubyid_install identifier id'>install</span> <span class='rubyid_acts_as_xlsx identifier id'>acts_as_xlsx</span>
97
- </pre>
98
-
99
- <h2>Usage</h2>
100
-
101
- <h3>Examples</h3>
102
-
103
- <p>Also see the writeups here:
104
- <a href="http://axlsx.blogspot.com/">http://axlsx.blogspot.com/</a></p>
105
-
106
- <p>A trivial rails example. In a production environment you will want to you stuff like x_sendfile and Tempfile<br/>
107
- <a href="http://www.therailsway.com/2009/2/22/file-downloads-done-right">http://www.therailsway.com/2009/2/22/file-downloads-done-right</a></p>
108
-
109
- <p>for nginx<br/>
110
- <a href="http://andrewtimberlake.com/blog/how-to-protect-downloads-but-still-have-nginx-serve-the-files">http://andrewtimberlake.com/blog/how-to-protect-downloads-but-still-have-nginx-serve-the-files</a></p>
111
-
112
- <pre class="code"> <span class='comment val'>#Add the gem to your Gemfile and bundle install</span>
113
- <span class='rubyid_gem identifier id'>gem</span> <span class='string val'>'acts_as_xlsx'</span>
114
-
115
- <span class='comment val'># app/models/post.rb</span>
116
- <span class='rubyid_class class kw'>class</span> <span class='rubyid_Post constant id'>Post</span> <span class='lt op'>&lt;</span> <span class='rubyid_ActiveRecord constant id'>ActiveRecord</span><span class='colon2 op'>::</span><span class='rubyid_Base constant id'>Base</span>
117
- <span class='rubyid_acts_as_xlsx identifier id'>acts_as_xlsx</span>
118
- <span class='rubyid_end end kw'>end</span>
119
-
120
- <span class='comment val'># app/controllers/posts_controller.rb</span>
121
- <span class='rubyid_class class kw'>class</span> <span class='rubyid_PostsController constant id'>PostsController</span> <span class='lt op'>&lt;</span> <span class='rubyid_ApplicationController constant id'>ApplicationController</span>
122
- <span class='comment val'># GET posts/xlsx </span>
123
- <span class='rubyid_def def kw'>def</span> <span class='rubyid_xlsx identifier id'>xlsx</span>
124
- <span class='rubyid_p identifier id'>p</span> <span class='assign token'>=</span> <span class='rubyid_Post constant id'>Post</span><span class='dot token'>.</span><span class='rubyid_to_xlsx identifier id'>to_xlsx</span>
125
- <span class='rubyid_p identifier id'>p</span><span class='dot token'>.</span><span class='rubyid_serialize identifier id'>serialize</span><span class='lparen token'>(</span><span class='string val'>'public/downloads/posts.xlsx'</span><span class='rparen token'>)</span>
126
- <span class='rubyid_send_file identifier id'>send_file</span> <span class='string val'>'public/downloads/posts.xlsx'</span><span class='comma token'>,</span> <span class='symbol val'>:type=</span><span class='gt op'>&gt;</span><span class='string val'>&quot;application/xlsx&quot;</span>
127
- <span class='rubyid_end end kw'>end</span>
128
- <span class='rubyid_end end kw'>end</span>
129
-
130
- <span class='comment val'># dont forget to add posts/xslx to your routes!</span>
131
- </pre>
132
-
133
- <p>In addition to dumping the entire table, it is also possible to specify the columns and method chains to execute in genrating your report.</p>
134
-
135
- <pre class="code"> <span class='comment val'># GET posts/xslx</span>
136
- <span class='rubyid_def def kw'>def</span> <span class='rubyid_xlsx identifier id'>xlsx</span>
137
- <span class='rubyid_p identifier id'>p</span> <span class='assign token'>=</span> <span class='rubyid_Post constant id'>Post</span><span class='dot token'>.</span><span class='rubyid_to_xlsx identifier id'>to_xlsx</span> <span class='symbol val'>:columns</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='lbrack token'>[</span><span class='symbol val'>:name</span><span class='comma token'>,</span> <span class='symbol val'>:title</span><span class='comma token'>,</span> <span class='symbol val'>:ranking</span><span class='comma token'>,</span> <span class='symbol val'>:'comments.last.content'</span><span class='comma token'>,</span> <span class='symbol val'>:'comments.last.author.name'</span><span class='rbrack token'>]</span>
138
- <span class='rubyid_p identifier id'>p</span><span class='dot token'>.</span><span class='rubyid_serialize identifier id'>serialize</span><span class='lparen token'>(</span><span class='string val'>'public/downloads/posts.xlsx'</span><span class='rparen token'>)</span>
139
- <span class='rubyid_send_file identifier id'>send_file</span> <span class='string val'>'public/downloads/posts.xlsx'</span><span class='comma token'>,</span> <span class='symbol val'>:type=</span><span class='gt op'>&gt;</span><span class='string val'>&quot;application/xlsx&quot;</span>
140
- <span class='rubyid_end end kw'>end</span>
141
- </pre>
142
-
143
- <p>If your application uses i18n, you can specify the prefix for column labels as well</p>
144
-
145
- <pre class="code"> <span class='comment val'># GET posts/xslx</span>
146
- <span class='rubyid_def def kw'>def</span> <span class='rubyid_xlsx identifier id'>xlsx</span>
147
- <span class='rubyid_p identifier id'>p</span> <span class='assign token'>=</span> <span class='rubyid_Post constant id'>Post</span><span class='dot token'>.</span><span class='rubyid_to_xlsx identifier id'>to_xlsx</span> <span class='symbol val'>:i18n</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='string val'>'activerecord.attributes'</span>
148
- <span class='rubyid_p identifier id'>p</span><span class='dot token'>.</span><span class='rubyid_serialize identifier id'>serialize</span><span class='lparen token'>(</span><span class='string val'>'public/downloads/posts.xlsx'</span><span class='rparen token'>)</span>
149
- <span class='rubyid_send_file identifier id'>send_file</span> <span class='string val'>'public/downloads/posts.xlsx'</span><span class='comma token'>,</span> <span class='symbol val'>:type=</span><span class='gt op'>&gt;</span><span class='string val'>&quot;application/xlsx&quot;</span>
150
- <span class='rubyid_end end kw'>end</span>
151
- </pre>
152
-
153
- <p>For examples on how to use axlsx for custom styles, charts, images and more see:</p>
154
-
155
- <pre class="code"> <span class='lbrack token'>[</span><span class='rubyid_http identifier id'>http</span><span class='symbol val'>:/</span><span class='regexp val'>/rubygems.org/</span><span class='rubyid_gems identifier id'>gems</span><span class='div op'>/</span><span class='rubyid_axlsx identifier id'>axlsx</span><span class='rbrack token'>]</span> <span class='lparen token'>(</span><span class='rubyid_https identifier id'>https</span><span class='symbol val'>:/</span><span class='regexp val'>/rubygems.org/</span><span class='rubyid_gems identifier id'>gems</span><span class='div op'>/</span><span class='rubyid_axlsx identifier id'>axlsx</span><span class='rparen token'>)</span>
156
- </pre>
157
-
158
- <h3>Documentation</h3>
159
-
160
- <p>This gem is 100% documented with YARD, an exceptional documentation library. To see documentation for this, and all the gems installed on your system use:</p>
161
-
162
- <pre class="code"> <span class='rubyid_gem identifier id'>gem</span> <span class='rubyid_install identifier id'>install</span> <span class='rubyid_yard identifier id'>yard</span>
163
- <span class='rubyid_yard identifier id'>yard</span> <span class='rubyid_server identifier id'>server</span> <span class='minus op'>-</span><span class='rubyid_g identifier id'>g</span>
164
- </pre>
165
-
166
- <h3>Specs</h3>
167
-
168
- <p>This gem has 100% coverage using Test::Unit</p>
169
-
170
- <h2>Changelog</h2>
171
-
172
- <ul>
173
- <li><p><strong>December.6.11</strong>: 1.0.3 release</p>
174
-
175
- <ul>
176
- <li>Added Mime type definition for rails to support respond_to |format| style handling in controllers.</li>
177
- </ul>
178
- </li>
179
- <li><p><strong>December.3.11</strong>: 1.0.2 release
180
- Added support for chained method columns like :'model.association.attribute'</p></li>
181
- <li><p><strong>October.30.11</strong>: 1.0.1 release</p>
182
-
183
- <ul>
184
- <li>Patch for inclusion error</li>
185
- </ul>
186
- </li>
187
- <li><p><strong>October.30.11</strong>: 1.0.0 release</p>
188
-
189
- <ul>
190
- <li>First release</li>
191
- </ul>
192
- </li>
193
- <li><p><strong>October.30.11</strong>: 1.0.0a release</p>
194
-
195
- <ul>
196
- <li>First pre release</li>
197
- </ul>
198
- </li>
199
- </ul>
200
-
201
-
202
- <p>Please see the <a href="file.CHANGELOG.html" title="CHANGELOG">CHANGELOG</a> document for past release information.</p>
203
-
204
- <h2>Copyright</h2>
205
-
206
- <p>Acts_as_xlsx &copy; 2011 by <a href="mailto:digial.ipseity@gmail.com">Randy Morgan</a>. Acts_as_xlsx is
207
- licensed under the MIT license. Please see the <a href="file.LICENSE.html" title="LICENSE">LICENSE</a> document for more information.</p>
208
- </div></div>
209
-
210
- <div id="footer">
211
- Generated on Tue Dec 6 18:49:18 2011 by
212
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
213
- 0.7.4 (ruby-1.8.7).
214
- </div>
215
-
216
- </body>
217
- </html>