muck-comments 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +13 -1
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/app/controllers/muck/comments_controller.rb +16 -1
- data/app/views/activity_templates/_comment.html.erb +1 -0
- data/app/views/comments/_form.html.erb +1 -1
- data/locales/en.yml +2 -1
- data/muck-comments.gemspec +27 -3
- data/pkg/muck-comments-0.1.1.gem +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/MuckComment/ClassMethods.html +160 -0
- data/rdoc/classes/ActiveRecord/Acts/MuckComment/InstanceMethods.html +178 -0
- data/rdoc/classes/ActiveRecord/Acts/MuckComment/SingletonMethods.html +212 -0
- data/rdoc/classes/ActiveRecord.html +105 -0
- data/rdoc/classes/Acts/CommentableWithThreading/ClassMethods.html +149 -0
- data/rdoc/classes/Acts/CommentableWithThreading/InstanceMethods.html +234 -0
- data/rdoc/classes/Acts/CommentableWithThreading/SingletonMethods.html +189 -0
- data/rdoc/classes/MuckComments/Tasks.html +146 -0
- data/rdoc/classes/MuckComments.html +111 -0
- data/rdoc/created.rid +1 -0
- data/rdoc/files/README_rdoc.html +161 -0
- data/rdoc/files/lib/active_record/acts/muck_comment_rb.html +101 -0
- data/rdoc/files/lib/acts_as_commentable_with_threading_rb.html +107 -0
- data/rdoc/files/lib/muck_comments/initialize_routes_rb.html +101 -0
- data/rdoc/files/lib/muck_comments/tasks_rb.html +110 -0
- data/rdoc/files/lib/muck_comments_rb.html +115 -0
- data/rdoc/fr_class_index.html +38 -0
- data/rdoc/fr_file_index.html +32 -0
- data/rdoc/fr_method_index.html +41 -0
- data/rdoc/index.html +24 -0
- data/rdoc/rdoc-style.css +208 -0
- metadata +27 -3
- data/pkg/muck-comments-0.1.0.gem +0 -0
@@ -0,0 +1,160 @@
|
|
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::MuckComment::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::MuckComment::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/muck_comment_rb.html">
|
59
|
+
lib/active_record/acts/muck_comment.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="#M000013">acts_as_muck_comment</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::MuckComment::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-M000013" class="method-detail">
|
113
|
+
<a name="M000013"></a>
|
114
|
+
|
115
|
+
<div class="method-heading">
|
116
|
+
<a href="#M000013" class="method-signature">
|
117
|
+
<span class="method-name">acts_as_muck_comment</span><span class="method-args">(options = {})</span>
|
118
|
+
</a>
|
119
|
+
</div>
|
120
|
+
|
121
|
+
<div class="method-description">
|
122
|
+
<p><a class="source-toggle" href="#"
|
123
|
+
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
|
124
|
+
<div class="method-source-code" id="M000013-source">
|
125
|
+
<pre>
|
126
|
+
<span class="ruby-comment cmt"># File lib/active_record/acts/muck_comment.rb, line 10</span>
|
127
|
+
10: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">acts_as_muck_comment</span>(<span class="ruby-identifier">options</span> = {})
|
128
|
+
11:
|
129
|
+
12: <span class="ruby-identifier">acts_as_nested_set</span> <span class="ruby-identifier">:scope</span> =<span class="ruby-operator">></span> [<span class="ruby-identifier">:commentable_id</span>, <span class="ruby-identifier">:commentable_type</span>]
|
130
|
+
13: <span class="ruby-identifier">validates_presence_of</span> <span class="ruby-identifier">:body</span>
|
131
|
+
14: <span class="ruby-identifier">belongs_to</span> <span class="ruby-identifier">:user</span>
|
132
|
+
15: <span class="ruby-identifier">belongs_to</span> <span class="ruby-identifier">:commentable</span>, <span class="ruby-identifier">:polymorphic</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">true</span>
|
133
|
+
16:
|
134
|
+
17: <span class="ruby-identifier">named_scope</span> <span class="ruby-identifier">:by_newest</span>, <span class="ruby-identifier">:order</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"created_at DESC"</span>
|
135
|
+
18: <span class="ruby-identifier">named_scope</span> <span class="ruby-identifier">:recent</span>, <span class="ruby-identifier">lambda</span> { { <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">></span> [<span class="ruby-value str">'created_at > ?'</span>, <span class="ruby-value">1</span>.<span class="ruby-identifier">week</span>.<span class="ruby-identifier">ago</span>] } }
|
136
|
+
19:
|
137
|
+
20: <span class="ruby-identifier">class_eval</span> <span class="ruby-value str">"\n# prevents a user from submitting a crafted form that bypasses activation\nattr_protected :created_at, :updated_at\n"</span>
|
138
|
+
21:
|
139
|
+
22: <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">MuckComment</span><span class="ruby-operator">::</span><span class="ruby-constant">InstanceMethods</span>
|
140
|
+
23: <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">MuckComment</span><span class="ruby-operator">::</span><span class="ruby-constant">SingletonMethods</span>
|
141
|
+
24:
|
142
|
+
25: <span class="ruby-keyword kw">end</span>
|
143
|
+
</pre>
|
144
|
+
</div>
|
145
|
+
</div>
|
146
|
+
</div>
|
147
|
+
|
148
|
+
|
149
|
+
</div>
|
150
|
+
|
151
|
+
|
152
|
+
</div>
|
153
|
+
|
154
|
+
|
155
|
+
<div id="validator-badges">
|
156
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
157
|
+
</div>
|
158
|
+
|
159
|
+
</body>
|
160
|
+
</html>
|
@@ -0,0 +1,178 @@
|
|
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::MuckComment::InstanceMethods</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::MuckComment::InstanceMethods</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/muck_comment_rb.html">
|
59
|
+
lib/active_record/acts/muck_comment.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
|
+
<div id="description">
|
76
|
+
<p>
|
77
|
+
All the methods available to a record that has had
|
78
|
+
<tt>acts_as_muck_comment</tt> specified.
|
79
|
+
</p>
|
80
|
+
|
81
|
+
</div>
|
82
|
+
|
83
|
+
|
84
|
+
</div>
|
85
|
+
|
86
|
+
<div id="method-list">
|
87
|
+
<h3 class="section-bar">Methods</h3>
|
88
|
+
|
89
|
+
<div class="name-list">
|
90
|
+
<a href="#M000015">can_edit?</a>
|
91
|
+
<a href="#M000014">has_children?</a>
|
92
|
+
</div>
|
93
|
+
</div>
|
94
|
+
|
95
|
+
</div>
|
96
|
+
|
97
|
+
|
98
|
+
<!-- if includes -->
|
99
|
+
|
100
|
+
<div id="section">
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
<!-- if method_list -->
|
110
|
+
<div id="methods">
|
111
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
112
|
+
|
113
|
+
<div id="method-M000015" class="method-detail">
|
114
|
+
<a name="M000015"></a>
|
115
|
+
|
116
|
+
<div class="method-heading">
|
117
|
+
<a href="#M000015" class="method-signature">
|
118
|
+
<span class="method-name">can_edit?</span><span class="method-args">(user)</span>
|
119
|
+
</a>
|
120
|
+
</div>
|
121
|
+
|
122
|
+
<div class="method-description">
|
123
|
+
<p>
|
124
|
+
override this method to change the way permissions are handled on comments
|
125
|
+
</p>
|
126
|
+
<p><a class="source-toggle" href="#"
|
127
|
+
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
|
128
|
+
<div class="method-source-code" id="M000015-source">
|
129
|
+
<pre>
|
130
|
+
<span class="ruby-comment cmt"># File lib/active_record/acts/muck_comment.rb, line 71</span>
|
131
|
+
71: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">can_edit?</span>(<span class="ruby-identifier">user</span>)
|
132
|
+
72: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">check_user</span>(<span class="ruby-identifier">user</span>)
|
133
|
+
73: <span class="ruby-keyword kw">false</span>
|
134
|
+
74: <span class="ruby-keyword kw">end</span>
|
135
|
+
</pre>
|
136
|
+
</div>
|
137
|
+
</div>
|
138
|
+
</div>
|
139
|
+
|
140
|
+
<div id="method-M000014" class="method-detail">
|
141
|
+
<a name="M000014"></a>
|
142
|
+
|
143
|
+
<div class="method-heading">
|
144
|
+
<a href="#M000014" class="method-signature">
|
145
|
+
<span class="method-name">has_children?</span><span class="method-args">()</span>
|
146
|
+
</a>
|
147
|
+
</div>
|
148
|
+
|
149
|
+
<div class="method-description">
|
150
|
+
<p>
|
151
|
+
helper method to check if a comment has children
|
152
|
+
</p>
|
153
|
+
<p><a class="source-toggle" href="#"
|
154
|
+
onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
|
155
|
+
<div class="method-source-code" id="M000014-source">
|
156
|
+
<pre>
|
157
|
+
<span class="ruby-comment cmt"># File lib/active_record/acts/muck_comment.rb, line 66</span>
|
158
|
+
66: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">has_children?</span>
|
159
|
+
67: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
160
|
+
68: <span class="ruby-keyword kw">end</span>
|
161
|
+
</pre>
|
162
|
+
</div>
|
163
|
+
</div>
|
164
|
+
</div>
|
165
|
+
|
166
|
+
|
167
|
+
</div>
|
168
|
+
|
169
|
+
|
170
|
+
</div>
|
171
|
+
|
172
|
+
|
173
|
+
<div id="validator-badges">
|
174
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
175
|
+
</div>
|
176
|
+
|
177
|
+
</body>
|
178
|
+
</html>
|
@@ -0,0 +1,212 @@
|
|
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::MuckComment::SingletonMethods</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::MuckComment::SingletonMethods</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/muck_comment_rb.html">
|
59
|
+
lib/active_record/acts/muck_comment.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
|
+
<div id="description">
|
76
|
+
<p>
|
77
|
+
class methods
|
78
|
+
</p>
|
79
|
+
|
80
|
+
</div>
|
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="#M000012">find_commentable</a>
|
90
|
+
<a href="#M000010">find_comments_by_user</a>
|
91
|
+
<a href="#M000011">find_comments_for_commentable</a>
|
92
|
+
</div>
|
93
|
+
</div>
|
94
|
+
|
95
|
+
</div>
|
96
|
+
|
97
|
+
|
98
|
+
<!-- if includes -->
|
99
|
+
|
100
|
+
<div id="section">
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
<!-- if method_list -->
|
110
|
+
<div id="methods">
|
111
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
112
|
+
|
113
|
+
<div id="method-M000012" class="method-detail">
|
114
|
+
<a name="M000012"></a>
|
115
|
+
|
116
|
+
<div class="method-heading">
|
117
|
+
<a href="#M000012" class="method-signature">
|
118
|
+
<span class="method-name">find_commentable</span><span class="method-args">(commentable_str, commentable_id)</span>
|
119
|
+
</a>
|
120
|
+
</div>
|
121
|
+
|
122
|
+
<div class="method-description">
|
123
|
+
<p>
|
124
|
+
Helper class method to look up a commentable object given the commentable
|
125
|
+
class name and id
|
126
|
+
</p>
|
127
|
+
<p><a class="source-toggle" href="#"
|
128
|
+
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
129
|
+
<div class="method-source-code" id="M000012-source">
|
130
|
+
<pre>
|
131
|
+
<span class="ruby-comment cmt"># File lib/active_record/acts/muck_comment.rb, line 56</span>
|
132
|
+
56: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find_commentable</span>(<span class="ruby-identifier">commentable_str</span>, <span class="ruby-identifier">commentable_id</span>)
|
133
|
+
57: <span class="ruby-identifier">commentable_str</span>.<span class="ruby-identifier">constantize</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">commentable_id</span>)
|
134
|
+
58: <span class="ruby-keyword kw">end</span>
|
135
|
+
</pre>
|
136
|
+
</div>
|
137
|
+
</div>
|
138
|
+
</div>
|
139
|
+
|
140
|
+
<div id="method-M000010" class="method-detail">
|
141
|
+
<a name="M000010"></a>
|
142
|
+
|
143
|
+
<div class="method-heading">
|
144
|
+
<a href="#M000010" class="method-signature">
|
145
|
+
<span class="method-name">find_comments_by_user</span><span class="method-args">(user)</span>
|
146
|
+
</a>
|
147
|
+
</div>
|
148
|
+
|
149
|
+
<div class="method-description">
|
150
|
+
<p>
|
151
|
+
Helper class method to lookup all comments assigned to all commentable
|
152
|
+
types for a given user.
|
153
|
+
</p>
|
154
|
+
<p><a class="source-toggle" href="#"
|
155
|
+
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
156
|
+
<div class="method-source-code" id="M000010-source">
|
157
|
+
<pre>
|
158
|
+
<span class="ruby-comment cmt"># File lib/active_record/acts/muck_comment.rb, line 38</span>
|
159
|
+
38: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find_comments_by_user</span>(<span class="ruby-identifier">user</span>)
|
160
|
+
39: <span class="ruby-identifier">find</span>(<span class="ruby-identifier">:all</span>,
|
161
|
+
40: <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">></span> [<span class="ruby-value str">"user_id = ?"</span>, <span class="ruby-identifier">user</span>.<span class="ruby-identifier">id</span>],
|
162
|
+
41: <span class="ruby-identifier">:order</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"created_at DESC"</span>
|
163
|
+
42: )
|
164
|
+
43: <span class="ruby-keyword kw">end</span>
|
165
|
+
</pre>
|
166
|
+
</div>
|
167
|
+
</div>
|
168
|
+
</div>
|
169
|
+
|
170
|
+
<div id="method-M000011" class="method-detail">
|
171
|
+
<a name="M000011"></a>
|
172
|
+
|
173
|
+
<div class="method-heading">
|
174
|
+
<a href="#M000011" class="method-signature">
|
175
|
+
<span class="method-name">find_comments_for_commentable</span><span class="method-args">(commentable_str, commentable_id)</span>
|
176
|
+
</a>
|
177
|
+
</div>
|
178
|
+
|
179
|
+
<div class="method-description">
|
180
|
+
<p>
|
181
|
+
Helper class method to look up all comments for commentable class name and
|
182
|
+
commentable id.
|
183
|
+
</p>
|
184
|
+
<p><a class="source-toggle" href="#"
|
185
|
+
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
186
|
+
<div class="method-source-code" id="M000011-source">
|
187
|
+
<pre>
|
188
|
+
<span class="ruby-comment cmt"># File lib/active_record/acts/muck_comment.rb, line 47</span>
|
189
|
+
47: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find_comments_for_commentable</span>(<span class="ruby-identifier">commentable_str</span>, <span class="ruby-identifier">commentable_id</span>)
|
190
|
+
48: <span class="ruby-identifier">find</span>(<span class="ruby-identifier">:all</span>,
|
191
|
+
49: <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">></span> [<span class="ruby-value str">"commentable_type = ? and commentable_id = ?"</span>, <span class="ruby-identifier">commentable_str</span>, <span class="ruby-identifier">commentable_id</span>],
|
192
|
+
50: <span class="ruby-identifier">:order</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"created_at DESC"</span>
|
193
|
+
51: )
|
194
|
+
52: <span class="ruby-keyword kw">end</span>
|
195
|
+
</pre>
|
196
|
+
</div>
|
197
|
+
</div>
|
198
|
+
</div>
|
199
|
+
|
200
|
+
|
201
|
+
</div>
|
202
|
+
|
203
|
+
|
204
|
+
</div>
|
205
|
+
|
206
|
+
|
207
|
+
<div id="validator-badges">
|
208
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
209
|
+
</div>
|
210
|
+
|
211
|
+
</body>
|
212
|
+
</html>
|
@@ -0,0 +1,105 @@
|
|
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</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</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/muck_comment_rb.html">
|
59
|
+
lib/active_record/acts/muck_comment.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
|
+
|
80
|
+
</div>
|
81
|
+
|
82
|
+
|
83
|
+
<!-- if includes -->
|
84
|
+
|
85
|
+
<div id="section">
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
<!-- if method_list -->
|
95
|
+
|
96
|
+
|
97
|
+
</div>
|
98
|
+
|
99
|
+
|
100
|
+
<div id="validator-badges">
|
101
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
102
|
+
</div>
|
103
|
+
|
104
|
+
</body>
|
105
|
+
</html>
|