uploader 0.1.16 → 0.1.17
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.
- data/.gitignore +5 -0
- data/VERSION +1 -1
- data/app/controllers/uploader/uploads_controller.rb +1 -1
- data/uploader.gemspec +4 -31
- metadata +3 -30
- data/rdoc/classes/ActionController/Routing/RouteSet.html +0 -148
- data/rdoc/classes/ActionController/Routing.html +0 -107
- data/rdoc/classes/ActionController.html +0 -107
- data/rdoc/classes/ActiveRecord/Acts/UploaderUpload/ClassMethods.html +0 -183
- data/rdoc/classes/ActiveRecord/Acts/UploaderUpload/InstanceMethods.html +0 -750
- data/rdoc/classes/ActiveRecord/Acts/UploaderUpload/SingletonMethods.html +0 -111
- data/rdoc/classes/ActiveRecord.html +0 -105
- data/rdoc/classes/Uploader/Exceptions/MissingTemplateError.html +0 -111
- data/rdoc/classes/Uploader/Exceptions.html +0 -111
- data/rdoc/classes/Uploader/FlashSessionCookieMiddleware.html +0 -177
- data/rdoc/classes/Uploader/MimeTypeGroups.html +0 -143
- data/rdoc/classes/Uploader/Tasks.html +0 -146
- data/rdoc/classes/Uploader.html +0 -126
- data/rdoc/created.rid +0 -1
- data/rdoc/files/README_rdoc.html +0 -515
- data/rdoc/files/lib/active_record/acts/uploader_upload_rb.html +0 -101
- data/rdoc/files/lib/daemons/amazonaws_rb.html +0 -107
- data/rdoc/files/lib/uploader/exceptions_rb.html +0 -101
- data/rdoc/files/lib/uploader/initialize_routes_rb.html +0 -101
- data/rdoc/files/lib/uploader/middleware/flash_session_cookie_middleware_rb.html +0 -108
- data/rdoc/files/lib/uploader/mime_type_groups_rb.html +0 -101
- data/rdoc/files/lib/uploader/tasks_rb.html +0 -110
- data/rdoc/files/lib/uploader_rb.html +0 -111
- data/rdoc/fr_class_index.html +0 -39
- data/rdoc/fr_file_index.html +0 -35
- data/rdoc/fr_method_index.html +0 -54
- data/rdoc/index.html +0 -24
- data/rdoc/rdoc-style.css +0 -208
@@ -1,183 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
-
<head>
|
8
|
-
<title>Module: ActiveRecord::Acts::UploaderUpload::ClassMethods</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
-
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
-
<script type="text/javascript">
|
13
|
-
// <![CDATA[
|
14
|
-
|
15
|
-
function popupCode( url ) {
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
-
}
|
18
|
-
|
19
|
-
function toggleCode( id ) {
|
20
|
-
if ( document.getElementById )
|
21
|
-
elem = document.getElementById( id );
|
22
|
-
else if ( document.all )
|
23
|
-
elem = eval( "document.all." + id );
|
24
|
-
else
|
25
|
-
return false;
|
26
|
-
|
27
|
-
elemStyle = elem.style;
|
28
|
-
|
29
|
-
if ( elemStyle.display != "block" ) {
|
30
|
-
elemStyle.display = "block"
|
31
|
-
} else {
|
32
|
-
elemStyle.display = "none"
|
33
|
-
}
|
34
|
-
|
35
|
-
return true;
|
36
|
-
}
|
37
|
-
|
38
|
-
// Make codeblocks hidden by default
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
-
|
41
|
-
// ]]>
|
42
|
-
</script>
|
43
|
-
|
44
|
-
</head>
|
45
|
-
<body>
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<div id="classHeader">
|
50
|
-
<table class="header-table">
|
51
|
-
<tr class="top-aligned-row">
|
52
|
-
<td><strong>Module</strong></td>
|
53
|
-
<td class="class-name-in-header">ActiveRecord::Acts::UploaderUpload::ClassMethods</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../../../files/lib/active_record/acts/uploader_upload_rb.html">
|
59
|
-
lib/active_record/acts/uploader_upload.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
|
65
|
-
</table>
|
66
|
-
</div>
|
67
|
-
<!-- banner header -->
|
68
|
-
|
69
|
-
<div id="bodyContent">
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
<div id="contextContent">
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
</div>
|
78
|
-
|
79
|
-
<div id="method-list">
|
80
|
-
<h3 class="section-bar">Methods</h3>
|
81
|
-
|
82
|
-
<div class="name-list">
|
83
|
-
<a href="#M000005">acts_as_uploader</a>
|
84
|
-
</div>
|
85
|
-
</div>
|
86
|
-
|
87
|
-
</div>
|
88
|
-
|
89
|
-
|
90
|
-
<!-- if includes -->
|
91
|
-
<div id="includes">
|
92
|
-
<h3 class="section-bar">Included Modules</h3>
|
93
|
-
|
94
|
-
<div id="includes-list">
|
95
|
-
<span class="include-name"><a href="InstanceMethods.html">ActiveRecord::Acts::UploaderUpload::InstanceMethods</a></span>
|
96
|
-
</div>
|
97
|
-
</div>
|
98
|
-
|
99
|
-
<div id="section">
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
<!-- if method_list -->
|
109
|
-
<div id="methods">
|
110
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
111
|
-
|
112
|
-
<div id="method-M000005" class="method-detail">
|
113
|
-
<a name="M000005"></a>
|
114
|
-
|
115
|
-
<div class="method-heading">
|
116
|
-
<a href="#M000005" class="method-signature">
|
117
|
-
<span class="method-name">acts_as_uploader</span><span class="method-args">(options)</span>
|
118
|
-
</a>
|
119
|
-
</div>
|
120
|
-
|
121
|
-
<div class="method-description">
|
122
|
-
<p>
|
123
|
-
<a href="ClassMethods.html#M000005">acts_as_uploader</a> requires an option
|
124
|
-
for :has_attached_file. These values will be passed to paperclip. i.e. <a
|
125
|
-
href="ClassMethods.html#M000005">acts_as_uploader</a> :has_attached_file
|
126
|
-
=> { :url =>
|
127
|
-
"/uploads/:class/:id/:style_:basename.:extension", :path =>
|
128
|
-
":rails_root/public/uploads/:class/:id/:style_:basename.:extension",
|
129
|
-
:styles => { :icon => "30x30!", :thumb =>
|
130
|
-
"100>", :small => "150>", :medium =>
|
131
|
-
"300>", :large => "660>"}, :default_url =>
|
132
|
-
"/images/profile_default.jpg" }
|
133
|
-
</p>
|
134
|
-
<p><a class="source-toggle" href="#"
|
135
|
-
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
136
|
-
<div class="method-source-code" id="M000005-source">
|
137
|
-
<pre>
|
138
|
-
<span class="ruby-comment cmt"># File lib/active_record/acts/uploader_upload.rb, line 18</span>
|
139
|
-
18: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">acts_as_uploader</span>(<span class="ruby-identifier">options</span>)
|
140
|
-
19:
|
141
|
-
20: <span class="ruby-comment cmt">#Named scopes</span>
|
142
|
-
21: <span class="ruby-identifier">named_scope</span> <span class="ruby-identifier">:newest_first</span>, <span class="ruby-identifier">:order</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"created_at DESC"</span>
|
143
|
-
22: <span class="ruby-identifier">named_scope</span> <span class="ruby-identifier">:alphabetic</span>, <span class="ruby-identifier">:order</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"filename DESC"</span>
|
144
|
-
23: <span class="ruby-identifier">named_scope</span> <span class="ruby-identifier">:recent</span>, <span class="ruby-identifier">:order</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"created_at DESC"</span>
|
145
|
-
24: <span class="ruby-identifier">named_scope</span> <span class="ruby-identifier">:public</span>, <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'is_public = true'</span>
|
146
|
-
25: <span class="ruby-identifier">named_scope</span> <span class="ruby-identifier">:images</span>, <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">></span> <span class="ruby-node">"local_content_type IN (#{Uploader::MimeTypeGroups::IMAGE_TYPES.collect{|type| "'#{type}'"}.join(',')})"</span>
|
147
|
-
26: <span class="ruby-identifier">named_scope</span> <span class="ruby-identifier">:documents</span>, <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">></span> <span class="ruby-node">"local_content_type IN (#{(Uploader::MimeTypeGroups::WORD_TYPES + Uploader::MimeTypeGroups::EXCEL_TYPES + Uploader::MimeTypeGroups::PDF_TYPES).collect{|type| "'#{type}'"}.join(',')})"</span>
|
148
|
-
27: <span class="ruby-identifier">named_scope</span> <span class="ruby-identifier">:files</span>, <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">></span> <span class="ruby-node">"local_content_type NOT IN (#{Uploader::MimeTypeGroups::IMAGE_TYPES.collect{|type| "'#{type}'"}.join(',')})"</span>
|
149
|
-
28: <span class="ruby-identifier">named_scope</span> <span class="ruby-identifier">:since</span>, <span class="ruby-identifier">lambda</span> { <span class="ruby-operator">|</span><span class="ruby-operator">*</span><span class="ruby-identifier">args</span><span class="ruby-operator">|</span> { <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">></span> [<span class="ruby-value str">"created_at > ?"</span>, (<span class="ruby-identifier">args</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">||</span> <span class="ruby-value">7</span>.<span class="ruby-identifier">days</span>.<span class="ruby-identifier">ago</span>.<span class="ruby-identifier">to_s</span>(<span class="ruby-identifier">:db</span>)) ]} }
|
150
|
-
29: <span class="ruby-identifier">named_scope</span> <span class="ruby-identifier">:pending_s3_migration</span>, <span class="ruby-identifier">lambda</span> { { <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">></span> [<span class="ruby-value str">"remote_file_name IS NULL AND created_at <= ?"</span>, <span class="ruby-value">20</span>.<span class="ruby-identifier">minutes</span>.<span class="ruby-identifier">ago</span>.<span class="ruby-identifier">to_s</span>(<span class="ruby-identifier">:db</span>)], <span class="ruby-identifier">:order</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'created_at DESC'</span> } }
|
151
|
-
30:
|
152
|
-
31: <span class="ruby-comment cmt"># Paperclip</span>
|
153
|
-
32: <span class="ruby-identifier">has_attached_file</span> <span class="ruby-identifier">:local</span>, <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:has_attached_file</span>].<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">:storage</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:filesystem</span>) <span class="ruby-comment cmt"># Override any storage settings. This one has to be local.</span>
|
154
|
-
33: <span class="ruby-identifier">has_attached_file</span> <span class="ruby-identifier">:remote</span>, <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:has_attached_file</span>].<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">:url</span> =<span class="ruby-operator">></span> <span class="ruby-value str">':s3_alias_url'</span>,
|
155
|
-
34: <span class="ruby-identifier">:path</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:s3_path</span>],
|
156
|
-
35: <span class="ruby-identifier">:storage</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:s3</span>)
|
157
|
-
36:
|
158
|
-
37: <span class="ruby-identifier">belongs_to</span> <span class="ruby-identifier">:uploadable</span>, <span class="ruby-identifier">:polymorphic</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">true</span>
|
159
|
-
38: <span class="ruby-identifier">belongs_to</span> <span class="ruby-identifier">:creator</span>, <span class="ruby-identifier">:class_name</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'User'</span>, <span class="ruby-identifier">:foreign_key</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'creator_id'</span>
|
160
|
-
39:
|
161
|
-
40: <span class="ruby-identifier">class_eval</span> <span class="ruby-value str">"\nbefore_post_process :transliterate_file_name\nbefore_create :add_width_and_height\n\n# prevents a user from submitting a crafted form that bypasses activation\nattr_protected :creator_id, :uploadable_id, :uploadable_type\n"</span>
|
162
|
-
41:
|
163
|
-
42: <span class="ruby-identifier">include</span> <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Acts</span><span class="ruby-operator">::</span><span class="ruby-constant">UploaderUpload</span><span class="ruby-operator">::</span><span class="ruby-constant">InstanceMethods</span>
|
164
|
-
43: <span class="ruby-identifier">extend</span> <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Acts</span><span class="ruby-operator">::</span><span class="ruby-constant">UploaderUpload</span><span class="ruby-operator">::</span><span class="ruby-constant">SingletonMethods</span>
|
165
|
-
44: <span class="ruby-keyword kw">end</span>
|
166
|
-
</pre>
|
167
|
-
</div>
|
168
|
-
</div>
|
169
|
-
</div>
|
170
|
-
|
171
|
-
|
172
|
-
</div>
|
173
|
-
|
174
|
-
|
175
|
-
</div>
|
176
|
-
|
177
|
-
|
178
|
-
<div id="validator-badges">
|
179
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
180
|
-
</div>
|
181
|
-
|
182
|
-
</body>
|
183
|
-
</html>
|