ideaoforder-acts_as_disqusable 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/MIT-LICENSE +20 -0
- data/Manifest.txt +38 -0
- data/README.rdoc +149 -0
- data/Rakefile +14 -0
- data/VERSION +1 -0
- data/acts_as_disqusable.gemspec +80 -0
- data/lib/acts_as_disqusable.rb +155 -0
- data/lib/acts_as_disqusable/author.rb +27 -0
- data/lib/acts_as_disqusable/forum.rb +118 -0
- data/lib/acts_as_disqusable/post.rb +31 -0
- data/lib/acts_as_disqusable/thread.rb +38 -0
- data/lib/disqus.rb +52 -0
- data/tasks/rcov.rake +23 -0
- data/test/api_test.rb +80 -0
- data/test/config.yml.sample +3 -0
- data/test/forum_test.rb +70 -0
- data/test/merb_test.rb +15 -0
- data/test/post_test.rb +18 -0
- data/test/rails_test.rb +18 -0
- data/test/responses/bad_api_key.json +1 -0
- data/test/responses/create_post.json +23 -0
- data/test/responses/get_forum_api_key.json +1 -0
- data/test/responses/get_forum_list.json +12 -0
- data/test/responses/get_num_posts.json +11 -0
- data/test/responses/get_thread_by_url.json +18 -0
- data/test/responses/get_thread_list.json +16 -0
- data/test/responses/get_thread_posts.json +37 -0
- data/test/responses/thread_by_identifier.json +17 -0
- data/test/responses/update_thread.json +5 -0
- data/test/test_helper.rb +32 -0
- data/test/thread_test.rb +28 -0
- data/test/view_helpers_test.rb +37 -0
- data/test/widget_test.rb +58 -0
- metadata +107 -0
data/.gitignore
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2008 [name of plugin creator]
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Manifest.txt
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
History.txt
|
2
|
+
MIT-LICENSE
|
3
|
+
Manifest.txt
|
4
|
+
README.rdoc
|
5
|
+
Rakefile
|
6
|
+
config/website.yml
|
7
|
+
disqus.gemspec
|
8
|
+
init.rb
|
9
|
+
lib/disqus.rb
|
10
|
+
lib/disqus/api.rb
|
11
|
+
lib/disqus/author.rb
|
12
|
+
lib/disqus/forum.rb
|
13
|
+
lib/disqus/post.rb
|
14
|
+
lib/disqus/thread.rb
|
15
|
+
lib/disqus/version.rb
|
16
|
+
lib/disqus/view_helpers.rb
|
17
|
+
lib/disqus/widget.rb
|
18
|
+
tasks/rcov.rake
|
19
|
+
test/api_test.rb
|
20
|
+
test/config.yml.sample
|
21
|
+
test/forum_test.rb
|
22
|
+
test/merb_test.rb
|
23
|
+
test/post_test.rb
|
24
|
+
test/rails_test.rb
|
25
|
+
test/responses/bad_api_key.json
|
26
|
+
test/responses/create_post.json
|
27
|
+
test/responses/get_forum_api_key.json
|
28
|
+
test/responses/get_forum_list.json
|
29
|
+
test/responses/get_num_posts.json
|
30
|
+
test/responses/get_thread_by_url.json
|
31
|
+
test/responses/get_thread_list.json
|
32
|
+
test/responses/get_thread_posts.json
|
33
|
+
test/responses/thread_by_identifier.json
|
34
|
+
test/responses/update_thread.json
|
35
|
+
test/test_helper.rb
|
36
|
+
test/thread_test.rb
|
37
|
+
test/view_helpers_test.rb
|
38
|
+
test/widget_test.rb
|
data/README.rdoc
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
== Acts-As-Disqusable Ruby Gem
|
2
|
+
|
3
|
+
The Acts-As-Disqusable Gem helps you easily integrate the {Disqus}[http://disqus.com]
|
4
|
+
commenting system into your website. It should work for any site programmed in Ruby.
|
5
|
+
|
6
|
+
It's a fork of Norman Clarke's Disqus Gem and incorporates Thomas Reynolds's DisqusParty changes (namely,
|
7
|
+
switching to HTTParty and using Jeweler for gem creation, as well as ditching the view helpers).
|
8
|
+
|
9
|
+
Disqus API support is "beta." Right now we're using API version 1.1.
|
10
|
+
|
11
|
+
=== What is Disqus?
|
12
|
+
|
13
|
+
From the Disqus website:
|
14
|
+
|
15
|
+
"Disqus, pronounced "discuss", is a service and tool for web comments and
|
16
|
+
discussions. The Disqus comment system can be plugged into any website, blog,
|
17
|
+
or application. Disqus makes commenting easier and more interactive, while
|
18
|
+
connecting websites and commenters across a thriving discussion community."
|
19
|
+
|
20
|
+
"Disqus is a free service to the general public with absolutely no inline advertisements."
|
21
|
+
|
22
|
+
=== Get it
|
23
|
+
|
24
|
+
gem install ideaoforder-acts_as_disqusable
|
25
|
+
|
26
|
+
=== Use it:
|
27
|
+
|
28
|
+
# easy!
|
29
|
+
class YOUR_MODEL
|
30
|
+
acts_as_disqusable
|
31
|
+
end
|
32
|
+
|
33
|
+
# For multiple forums
|
34
|
+
class YOUR_MODEL
|
35
|
+
acts_as_disqusable, :forum_id => X, :forum_shortname => X, :forum_api_key => X
|
36
|
+
end
|
37
|
+
|
38
|
+
# with nonstandard DB fields
|
39
|
+
class YOUR_MODEL
|
40
|
+
# title, slug, and thread_id default to title, slug, and thread_id...surprise!
|
41
|
+
acts_as_disqusable, :title_column => 'name',
|
42
|
+
:slug_column => 'permalink',
|
43
|
+
:thread_id => 'your_mom',
|
44
|
+
:prefix => false # this defaults to the associated controller
|
45
|
+
# so Post would create a link like: '/posts/slug/
|
46
|
+
# you can set this to false for just: '/slug'
|
47
|
+
# or to a different path: '/blog/slug'
|
48
|
+
end
|
49
|
+
|
50
|
+
OPTIONAL:
|
51
|
+
You should create a :thread_id field in the database for each model
|
52
|
+
that is disqusable. This will result in fewer requests to Disqus.
|
53
|
+
Everything but YOUR_MODEL.comment_count() should work without it.
|
54
|
+
|
55
|
+
==== Configure it:
|
56
|
+
|
57
|
+
===== Example - This goes in config/disqus.yml:
|
58
|
+
- :api_key: YOUR_API_KEY
|
59
|
+
- :account: YOUR_ACCOUNT_NAME
|
60
|
+
- :developer: true or false
|
61
|
+
|
62
|
+
If you're only connecting 1 forum to your site:
|
63
|
+
|
64
|
+
- :forum_api_key: YOUR_FORUM_API_KEY
|
65
|
+
- :forum_id: YOUR_FORUM_ID
|
66
|
+
- :forum_shortname: YOUR_FORUM_SHORTNAME
|
67
|
+
|
68
|
+
Otherwise, the forum info goes in the model that's disqusable.
|
69
|
+
You could use a different forum for each model.
|
70
|
+
It would be better to use the new category feature, however.
|
71
|
+
Sadly, I haven't had time to program that yet.
|
72
|
+
|
73
|
+
===== Options
|
74
|
+
|
75
|
+
:api_key => "" # your api key
|
76
|
+
:account => "", # your disqus account
|
77
|
+
:developer => false, # allows for threads to work on localhost if set to true
|
78
|
+
:container_id => 'disqus_thread', # desired thread container
|
79
|
+
:avatar_size => 48, # squared pixel size of avatars
|
80
|
+
:num_items => 5, # number of comments to display / this is just the default
|
81
|
+
:forum_api_key => "" # your forum api key
|
82
|
+
:forum_id => "" # your forum id
|
83
|
+
:forum_shortname => "" # your forum shortname
|
84
|
+
|
85
|
+
==== To get your forum info, in the console:
|
86
|
+
|
87
|
+
f = Disqus::Forum.all
|
88
|
+
|
89
|
+
# find your forum, let's say it's the first
|
90
|
+
|
91
|
+
f.first.id
|
92
|
+
f.first.key
|
93
|
+
f.first.shortname
|
94
|
+
|
95
|
+
==== So:
|
96
|
+
|
97
|
+
Let's say Post are disqusable.
|
98
|
+
|
99
|
+
Then
|
100
|
+
|
101
|
+
Post.comments(:limit => 5, :exclude => 'spam') # class level
|
102
|
+
|
103
|
+
Will grab the 5 most recent non-spam comments. The default
|
104
|
+
limit and exclude are 5 and 'spam'.
|
105
|
+
|
106
|
+
@post.comments
|
107
|
+
|
108
|
+
Will grab the comments for a post.
|
109
|
+
|
110
|
+
@post.comment_count
|
111
|
+
|
112
|
+
Will grab the number of comments for a given post.
|
113
|
+
|
114
|
+
@post.comment_form
|
115
|
+
|
116
|
+
Will create a comment form appropriate to the @post. This still uses the
|
117
|
+
older javascript form.
|
118
|
+
|
119
|
+
==== There are lots of other options for Threads/Forums etc.
|
120
|
+
|
121
|
+
|
122
|
+
==== Work with the Disqus API:
|
123
|
+
|
124
|
+
See the Disqus::Api class for more info on the Disqus API. You can also read
|
125
|
+
the {Disqus developer info here}[http://disqus.com/docs/api/].
|
126
|
+
|
127
|
+
=== Hack it:
|
128
|
+
|
129
|
+
Github repository:
|
130
|
+
|
131
|
+
http://github.com/ideaoforder/acts_as_disqusable/
|
132
|
+
|
133
|
+
=== Learn more about Disqus:
|
134
|
+
|
135
|
+
{http://disqus.com}[http://disqus.com]
|
136
|
+
|
137
|
+
=== Thanks to the following contributors:
|
138
|
+
* {Thomas Reynolds}[http://github.com/tdreyno] - DisqusParty Gem
|
139
|
+
* {Norman Clarke}[http://github.com/norman] - Disqus Gem
|
140
|
+
* {Matt Van Horn}[http://github.com/mattvanhorn] - Disqus API
|
141
|
+
|
142
|
+
=== Legal Stuff
|
143
|
+
|
144
|
+
The Disqus Ruby gem was not created by, nor is officially supported by
|
145
|
+
Disqus.com or Big Head Labs, Inc. Use it at your own risk and your own
|
146
|
+
responsibility under the terms of the MIT License.
|
147
|
+
|
148
|
+
Copyright (c) 2008 {Mark Dickson}[mailto:mark@sitesteaders.com], released under
|
149
|
+
the MIT license
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
begin
|
2
|
+
require 'jeweler'
|
3
|
+
Jeweler::Tasks.new do |gemspec|
|
4
|
+
gemspec.name = "acts_as_disqusable"
|
5
|
+
gemspec.summary = "Uses the Disqus API to make model(s) comment-on-able"
|
6
|
+
gemspec.description = "Uses the Disqus API to make model(s) comment-on-able"
|
7
|
+
gemspec.email = "mark@sitesteaders.com"
|
8
|
+
gemspec.homepage = "http://github.com/ideaoforder/disqus"
|
9
|
+
gemspec.authors = ["Mark Dickson", "Thomas Reynolds", "Norman Clarke", "Matthew Van Horn"]
|
10
|
+
gemspec.add_dependency('httparty', '>= 0.4.4')
|
11
|
+
end
|
12
|
+
rescue LoadError
|
13
|
+
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
14
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.4.0
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{acts_as_disqusable}
|
5
|
+
s.version = "0.4.0"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Mark Dickson", "Thomas Reynolds", "Norman Clarke", "Matthew Van Horn"]
|
9
|
+
s.date = %q{2009-08-05}
|
10
|
+
s.description = %q{Uses the Disqus API to make model(s) comment-on-able}
|
11
|
+
s.email = %q{mark@sitesteaders.com}
|
12
|
+
s.extra_rdoc_files = [
|
13
|
+
"README.rdoc"
|
14
|
+
]
|
15
|
+
s.files = [
|
16
|
+
".gitignore",
|
17
|
+
"MIT-LICENSE",
|
18
|
+
"Manifest.txt",
|
19
|
+
"README.rdoc",
|
20
|
+
"Rakefile",
|
21
|
+
"VERSION",
|
22
|
+
"acts_as_disqusable.gemspec",
|
23
|
+
"lib/acts_as_disqusable.rb",
|
24
|
+
"lib/acts_as_disqusable/author.rb",
|
25
|
+
"lib/acts_as_disqusable/forum.rb",
|
26
|
+
"lib/acts_as_disqusable/post.rb",
|
27
|
+
"lib/acts_as_disqusable/thread.rb",
|
28
|
+
"lib/disqus.rb",
|
29
|
+
"tasks/rcov.rake",
|
30
|
+
"test/api_test.rb",
|
31
|
+
"test/config.yml.sample",
|
32
|
+
"test/forum_test.rb",
|
33
|
+
"test/merb_test.rb",
|
34
|
+
"test/post_test.rb",
|
35
|
+
"test/rails_test.rb",
|
36
|
+
"test/responses/bad_api_key.json",
|
37
|
+
"test/responses/create_post.json",
|
38
|
+
"test/responses/get_forum_api_key.json",
|
39
|
+
"test/responses/get_forum_list.json",
|
40
|
+
"test/responses/get_num_posts.json",
|
41
|
+
"test/responses/get_thread_by_url.json",
|
42
|
+
"test/responses/get_thread_list.json",
|
43
|
+
"test/responses/get_thread_posts.json",
|
44
|
+
"test/responses/thread_by_identifier.json",
|
45
|
+
"test/responses/update_thread.json",
|
46
|
+
"test/test_helper.rb",
|
47
|
+
"test/thread_test.rb",
|
48
|
+
"test/view_helpers_test.rb",
|
49
|
+
"test/widget_test.rb"
|
50
|
+
]
|
51
|
+
s.homepage = %q{http://github.com/ideaoforder/disqus}
|
52
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
53
|
+
s.require_paths = ["lib"]
|
54
|
+
s.rubygems_version = %q{1.3.5}
|
55
|
+
s.summary = %q{Uses the Disqus API to make model(s) comment-on-able}
|
56
|
+
s.test_files = [
|
57
|
+
"test/merb_test.rb",
|
58
|
+
"test/view_helpers_test.rb",
|
59
|
+
"test/widget_test.rb",
|
60
|
+
"test/api_test.rb",
|
61
|
+
"test/post_test.rb",
|
62
|
+
"test/thread_test.rb",
|
63
|
+
"test/rails_test.rb",
|
64
|
+
"test/forum_test.rb",
|
65
|
+
"test/test_helper.rb"
|
66
|
+
]
|
67
|
+
|
68
|
+
if s.respond_to? :specification_version then
|
69
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
70
|
+
s.specification_version = 3
|
71
|
+
|
72
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
73
|
+
s.add_runtime_dependency(%q<httparty>, [">= 0.4.4"])
|
74
|
+
else
|
75
|
+
s.add_dependency(%q<httparty>, [">= 0.4.4"])
|
76
|
+
end
|
77
|
+
else
|
78
|
+
s.add_dependency(%q<httparty>, [">= 0.4.4"])
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,155 @@
|
|
1
|
+
module ActiveRecord #:nodoc:
|
2
|
+
module Acts #:nodoc:
|
3
|
+
module Disqusable #:nodoc:
|
4
|
+
require 'disqus'
|
5
|
+
|
6
|
+
def self.included(base)
|
7
|
+
base.extend(ClassMethods)
|
8
|
+
end
|
9
|
+
|
10
|
+
module ClassMethods
|
11
|
+
# Macro that adds theme for object
|
12
|
+
def acts_as_disqusable(options = {})
|
13
|
+
@@configuration = YAML::load(File.open("#{RAILS_ROOT}/config/disqus.yml"))
|
14
|
+
@@configuration.update(options) if options.is_a?(Hash)
|
15
|
+
include ActiveRecord::Acts::Disqusable::InstanceMethods
|
16
|
+
|
17
|
+
after_create :create_thread
|
18
|
+
|
19
|
+
def thread_column
|
20
|
+
@@configuration[:thread_column] || 'thread_id'
|
21
|
+
end
|
22
|
+
|
23
|
+
def title_column
|
24
|
+
@@configuration[:title_column] || 'title'
|
25
|
+
end
|
26
|
+
|
27
|
+
def slug_column
|
28
|
+
@@configuration[:slug_column] || 'slug'
|
29
|
+
end
|
30
|
+
|
31
|
+
def prefix
|
32
|
+
if @@configuration[:prefix].nil?
|
33
|
+
return self.to_s.downcase + '-'
|
34
|
+
elsif @@configuration[:prefix]
|
35
|
+
return @@configuration[:prefix] + '-'
|
36
|
+
else
|
37
|
+
return ''
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def forum_id
|
42
|
+
@@configuration[:forum_id].to_s || nil
|
43
|
+
end
|
44
|
+
|
45
|
+
def forum_api_key
|
46
|
+
@@configuration[:forum_api_key] || nil
|
47
|
+
end
|
48
|
+
|
49
|
+
def forum_shortname
|
50
|
+
@@configuration[:forum_shortname] || nil
|
51
|
+
end
|
52
|
+
|
53
|
+
def threads
|
54
|
+
Disqus::Forum.find(self.forum_id).threads
|
55
|
+
end
|
56
|
+
|
57
|
+
def find_thread_by_url(url)
|
58
|
+
Disqus::Forum.get_thread_by_url(url, self.forum_api_key)
|
59
|
+
end
|
60
|
+
|
61
|
+
def comment_count(ids={})
|
62
|
+
if self.column_names.include? self.thread_column
|
63
|
+
if !ids.is_a? Hash
|
64
|
+
c = "id IN (" + ids.join(',')+ ")"
|
65
|
+
else
|
66
|
+
c = nil
|
67
|
+
end
|
68
|
+
thread_ids = Post.all(:conditions => c, :select => :thread_id).collect(&:thread_id).compact.join(',')
|
69
|
+
if thread_ids.length > 0
|
70
|
+
Disqus::Forum.posts_count(thread_ids, self.forum_api_key)
|
71
|
+
else
|
72
|
+
Hash.new
|
73
|
+
end
|
74
|
+
else
|
75
|
+
'This operation is not supported without a thread_column.'
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# limit — Number of entries that should be included in the response. Default is 25.
|
80
|
+
# start — Starting point for the query. Default is 0.
|
81
|
+
# filter — Type of entries that should be returned (new, spam or killed).
|
82
|
+
# exclude — Type of entries that should be excluded from the response (new, spam or killed).
|
83
|
+
def comments(opts={})
|
84
|
+
Disqus::Forum.posts(self.forum_api_key, opts)
|
85
|
+
end
|
86
|
+
|
87
|
+
def comment_permalink(comment, opts={})
|
88
|
+
title = comment.thread['title']
|
89
|
+
if comment.thread['url']
|
90
|
+
permalink = comment.thread['url']
|
91
|
+
else
|
92
|
+
url = comment.thread['identifier'].first.sub(self.prefix, '')
|
93
|
+
path = opts[:path] || self.to_s.pluralize.downcase
|
94
|
+
permalink = "/#{path}/#{url}"
|
95
|
+
end
|
96
|
+
return "<a href=\"#{permalink}\" class=\"#{opts[:class]}\" title=\"#{opts[:title]}\">#{title}</a>"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
module InstanceMethods
|
102
|
+
def thread_identifier
|
103
|
+
self.class.prefix + self.send(self.class.slug_column)
|
104
|
+
end
|
105
|
+
|
106
|
+
def thread
|
107
|
+
Disqus::Thread.find_or_create(self.send(self.class.title_column), self.thread_identifier)
|
108
|
+
end
|
109
|
+
|
110
|
+
# limit — Number of entries that should be included in the response. Default is 25.
|
111
|
+
# start — Starting point for the query. Default is 0.
|
112
|
+
# filter — Type of entries that should be returned (new, spam or killed).
|
113
|
+
# exclude — Type of entries that should be excluded from the response (new, spam or killed).
|
114
|
+
def comments(opts={})
|
115
|
+
if self.respond_to? self.class.thread_column and self.send(self.class.thread_column)
|
116
|
+
Disqus::Thread.posts(self.send(self.class.thread_column), opts)
|
117
|
+
else # two separate calls
|
118
|
+
Disqus::Thread.find_or_create(title, slug).posts(opts)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def comment_count
|
123
|
+
if self.respond_to? self.class.thread_column and self.send(self.class.thread_column)
|
124
|
+
Disqus::Forum.posts_count(self.send(self.class.thread_column), self.class.forum_api_key)
|
125
|
+
else # two separate calls
|
126
|
+
Disqus::Thread.find_or_create(title, slug).posts_count
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
def comment_form
|
131
|
+
forum_shortname = self.class.forum_shortname
|
132
|
+
thread_indentifier = self.thread_identifier
|
133
|
+
url = 'http://disqus.com/api/reply.js?' +
|
134
|
+
"forum_shortname=#{forum_shortname}&" +
|
135
|
+
"thread_identifier=#{thread_identifier}"
|
136
|
+
s = '<div id="dsq-reply">'
|
137
|
+
s << '<script type="text/javascript" src="%s"></script>' % url
|
138
|
+
s << '</div>'
|
139
|
+
return s
|
140
|
+
end
|
141
|
+
|
142
|
+
private
|
143
|
+
def create_thread
|
144
|
+
t = Disqus::Thread.find_or_create(self.send(self.class.title_column), self.thread_identifier)
|
145
|
+
if self.respond_to? self.class.thread_column
|
146
|
+
self.write_attribute(self.class.thread_column, t.id)
|
147
|
+
self.save
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
ActiveRecord::Base.send(:include, ActiveRecord::Acts::Disqusable)
|