uploader 0.1.3 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +81 -33
- data/Rakefile +2 -2
- data/TODO +2 -1
- data/VERSION +1 -1
- data/app/controllers/uploader/uploads_controller.rb +13 -9
- data/app/views/uploads/_swf_upload.html.erb +1 -1
- data/lib/active_record/acts/uploader_upload.rb +12 -13
- data/lib/daemons/amazonaws.rb +36 -0
- data/lib/uploader/tasks.rb +9 -3
- data/public/images/file_icons/excel.gif +0 -0
- data/public/images/file_icons/file.gif +0 -0
- data/public/images/file_icons/file.png +0 -0
- data/public/images/file_icons/file_aac.gif +0 -0
- data/public/images/file_icons/file_ai.gif +0 -0
- data/public/images/file_icons/file_avi.gif +0 -0
- data/public/images/file_icons/file_bin.gif +0 -0
- data/public/images/file_icons/file_bmp.gif +0 -0
- data/public/images/file_icons/file_cue.gif +0 -0
- data/public/images/file_icons/file_divx.gif +0 -0
- data/public/images/file_icons/file_doc.gif +0 -0
- data/public/images/file_icons/file_eps.gif +0 -0
- data/public/images/file_icons/file_flac.gif +0 -0
- data/public/images/file_icons/file_flv.gif +0 -0
- data/public/images/file_icons/file_gif.gif +0 -0
- data/public/images/file_icons/file_html.gif +0 -0
- data/public/images/file_icons/file_ical.gif +0 -0
- data/public/images/file_icons/file_indd.gif +0 -0
- data/public/images/file_icons/file_inx.gif +0 -0
- data/public/images/file_icons/file_iso.gif +0 -0
- data/public/images/file_icons/file_jpg.gif +0 -0
- data/public/images/file_icons/file_mov.gif +0 -0
- data/public/images/file_icons/file_mp3.gif +0 -0
- data/public/images/file_icons/file_mpg.gif +0 -0
- data/public/images/file_icons/file_pdf.gif +0 -0
- data/public/images/file_icons/file_php.gif +0 -0
- data/public/images/file_icons/file_png.gif +0 -0
- data/public/images/file_icons/file_pps.gif +0 -0
- data/public/images/file_icons/file_ppt.gif +0 -0
- data/public/images/file_icons/file_psd.gif +0 -0
- data/public/images/file_icons/file_qxd.gif +0 -0
- data/public/images/file_icons/file_qxp.gif +0 -0
- data/public/images/file_icons/file_raw.gif +0 -0
- data/public/images/file_icons/file_rtf.gif +0 -0
- data/public/images/file_icons/file_svg.gif +0 -0
- data/public/images/file_icons/file_tif.gif +0 -0
- data/public/images/file_icons/file_txt.gif +0 -0
- data/public/images/file_icons/file_vcf.gif +0 -0
- data/public/images/file_icons/file_wav.gif +0 -0
- data/public/images/file_icons/file_wma.gif +0 -0
- data/public/images/file_icons/file_xls.gif +0 -0
- data/public/images/file_icons/file_xml.gif +0 -0
- data/public/images/file_icons/pdf.gif +0 -0
- data/public/images/file_icons/pdf.png +0 -0
- data/public/images/file_icons/text.gif +0 -0
- data/public/images/file_icons/text.png +0 -0
- data/rdoc/classes/ActionController/Routing/RouteSet.html +148 -0
- data/rdoc/classes/ActionController/Routing.html +107 -0
- data/rdoc/classes/ActionController.html +107 -0
- data/rdoc/classes/ActiveRecord/Acts/UploaderUpload/ClassMethods.html +188 -0
- data/rdoc/classes/ActiveRecord/Acts/UploaderUpload/InstanceMethods.html +750 -0
- data/rdoc/classes/ActiveRecord/Acts/UploaderUpload/SingletonMethods.html +111 -0
- data/rdoc/classes/ActiveRecord.html +105 -0
- data/rdoc/classes/Uploader/Exceptions/MissingTemplateError.html +111 -0
- data/rdoc/classes/Uploader/Exceptions.html +111 -0
- data/rdoc/classes/Uploader/FlashSessionCookieMiddleware.html +177 -0
- data/rdoc/classes/Uploader/MimeTypeGroups.html +143 -0
- data/rdoc/classes/Uploader/Tasks.html +146 -0
- data/rdoc/classes/Uploader.html +126 -0
- data/rdoc/created.rid +1 -0
- data/rdoc/files/README_rdoc.html +427 -0
- data/rdoc/files/lib/active_record/acts/uploader_upload_rb.html +101 -0
- data/rdoc/files/lib/uploader/exceptions_rb.html +101 -0
- data/rdoc/files/lib/uploader/initialize_routes_rb.html +101 -0
- data/rdoc/files/lib/uploader/middleware/flash_session_cookie_middleware_rb.html +108 -0
- data/rdoc/files/lib/uploader/mime_type_groups_rb.html +101 -0
- data/rdoc/files/lib/uploader/tasks_rb.html +110 -0
- data/rdoc/files/lib/uploader_rb.html +112 -0
- data/rdoc/fr_class_index.html +39 -0
- data/rdoc/fr_file_index.html +34 -0
- data/rdoc/fr_method_index.html +54 -0
- data/rdoc/index.html +24 -0
- data/rdoc/rdoc-style.css +208 -0
- data/uploader.gemspec +72 -20
- metadata +72 -5
- data/pkg/uploader-0.1.0.gem +0 -0
- data/pkg/uploader-0.1.1.gem +0 -0
- data/pkg/uploader-0.1.2.gem +0 -0
@@ -0,0 +1,148 @@
|
|
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>Class: ActionController::Routing::RouteSet</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>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">ActionController::Routing::RouteSet</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/uploader/initialize_routes_rb.html">
|
59
|
+
lib/uploader/initialize_routes.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div id="method-list">
|
86
|
+
<h3 class="section-bar">Methods</h3>
|
87
|
+
|
88
|
+
<div class="name-list">
|
89
|
+
<a href="#M000001">load_routes_with_uploader!</a>
|
90
|
+
</div>
|
91
|
+
</div>
|
92
|
+
|
93
|
+
</div>
|
94
|
+
|
95
|
+
|
96
|
+
<!-- if includes -->
|
97
|
+
|
98
|
+
<div id="section">
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
<!-- if method_list -->
|
108
|
+
<div id="methods">
|
109
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
110
|
+
|
111
|
+
<div id="method-M000001" class="method-detail">
|
112
|
+
<a name="M000001"></a>
|
113
|
+
|
114
|
+
<div class="method-heading">
|
115
|
+
<a href="#M000001" class="method-signature">
|
116
|
+
<span class="method-name">load_routes_with_uploader!</span><span class="method-args">()</span>
|
117
|
+
</a>
|
118
|
+
</div>
|
119
|
+
|
120
|
+
<div class="method-description">
|
121
|
+
<p><a class="source-toggle" href="#"
|
122
|
+
onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
|
123
|
+
<div class="method-source-code" id="M000001-source">
|
124
|
+
<pre>
|
125
|
+
<span class="ruby-comment cmt"># File lib/uploader/initialize_routes.rb, line 2</span>
|
126
|
+
2: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_routes_with_uploader!</span>
|
127
|
+
3: <span class="ruby-identifier">uploader_routes</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword kw">__FILE__</span>), <span class="ruby-operator">*</span><span class="ruby-node">%w[.. .. config uploader_routes.rb]</span>)
|
128
|
+
4: <span class="ruby-identifier">add_configuration_file</span>(<span class="ruby-identifier">uploader_routes</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">configuration_files</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">uploader_routes</span>
|
129
|
+
5: <span class="ruby-identifier">load_routes_without_uploader!</span>
|
130
|
+
6: <span class="ruby-keyword kw">end</span>
|
131
|
+
</pre>
|
132
|
+
</div>
|
133
|
+
</div>
|
134
|
+
</div>
|
135
|
+
|
136
|
+
|
137
|
+
</div>
|
138
|
+
|
139
|
+
|
140
|
+
</div>
|
141
|
+
|
142
|
+
|
143
|
+
<div id="validator-badges">
|
144
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
145
|
+
</div>
|
146
|
+
|
147
|
+
</body>
|
148
|
+
</html>
|
@@ -0,0 +1,107 @@
|
|
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: ActionController::Routing</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">ActionController::Routing</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
</td>
|
59
|
+
</tr>
|
60
|
+
|
61
|
+
</table>
|
62
|
+
</div>
|
63
|
+
<!-- banner header -->
|
64
|
+
|
65
|
+
<div id="bodyContent">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<div id="contextContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
</div>
|
74
|
+
|
75
|
+
|
76
|
+
</div>
|
77
|
+
|
78
|
+
|
79
|
+
<!-- if includes -->
|
80
|
+
|
81
|
+
<div id="section">
|
82
|
+
|
83
|
+
<div id="class-list">
|
84
|
+
<h3 class="section-bar">Classes and Modules</h3>
|
85
|
+
|
86
|
+
Class <a href="Routing/RouteSet.html" class="link">ActionController::Routing::RouteSet</a><br />
|
87
|
+
|
88
|
+
</div>
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
<!-- if method_list -->
|
97
|
+
|
98
|
+
|
99
|
+
</div>
|
100
|
+
|
101
|
+
|
102
|
+
<div id="validator-badges">
|
103
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
104
|
+
</div>
|
105
|
+
|
106
|
+
</body>
|
107
|
+
</html>
|
@@ -0,0 +1,107 @@
|
|
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: ActionController</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">ActionController</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
</td>
|
59
|
+
</tr>
|
60
|
+
|
61
|
+
</table>
|
62
|
+
</div>
|
63
|
+
<!-- banner header -->
|
64
|
+
|
65
|
+
<div id="bodyContent">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<div id="contextContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
</div>
|
74
|
+
|
75
|
+
|
76
|
+
</div>
|
77
|
+
|
78
|
+
|
79
|
+
<!-- if includes -->
|
80
|
+
|
81
|
+
<div id="section">
|
82
|
+
|
83
|
+
<div id="class-list">
|
84
|
+
<h3 class="section-bar">Classes and Modules</h3>
|
85
|
+
|
86
|
+
Module <a href="ActionController/Routing.html" class="link">ActionController::Routing</a><br />
|
87
|
+
|
88
|
+
</div>
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
<!-- if method_list -->
|
97
|
+
|
98
|
+
|
99
|
+
</div>
|
100
|
+
|
101
|
+
|
102
|
+
<div id="validator-badges">
|
103
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
104
|
+
</div>
|
105
|
+
|
106
|
+
</body>
|
107
|
+
</html>
|
@@ -0,0 +1,188 @@
|
|
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> {
|
151
|
+
30: { <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>)],
|
152
|
+
31: <span class="ruby-identifier">:order</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'created_at DESC'</span>,
|
153
|
+
32: <span class="ruby-identifier">:limit</span> =<span class="ruby-operator">></span> <span class="ruby-value">1</span> }
|
154
|
+
33: }
|
155
|
+
34:
|
156
|
+
35: <span class="ruby-comment cmt"># Paperclip</span>
|
157
|
+
36: <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>
|
158
|
+
37: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:enable_s3</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword kw">true</span>
|
159
|
+
38: <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>]
|
160
|
+
39: <span class="ruby-keyword kw">end</span>
|
161
|
+
40:
|
162
|
+
41:
|
163
|
+
42: <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>
|
164
|
+
43: <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>
|
165
|
+
44:
|
166
|
+
45: <span class="ruby-identifier">class_eval</span> <span class="ruby-value str">"validates_attachment_size :local, :less_than => 10.megabytes\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>
|
167
|
+
46:
|
168
|
+
47: <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>
|
169
|
+
48: <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>
|
170
|
+
49: <span class="ruby-keyword kw">end</span>
|
171
|
+
</pre>
|
172
|
+
</div>
|
173
|
+
</div>
|
174
|
+
</div>
|
175
|
+
|
176
|
+
|
177
|
+
</div>
|
178
|
+
|
179
|
+
|
180
|
+
</div>
|
181
|
+
|
182
|
+
|
183
|
+
<div id="validator-badges">
|
184
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
185
|
+
</div>
|
186
|
+
|
187
|
+
</body>
|
188
|
+
</html>
|