public
Fork of halorgium/mephisto
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/technoweenie/mephisto.git
Search Repo:
Click here to lend your support to: mephisto and make a donation at www.pledgie.com !
did i fix the nil.accept_comments? error? I think so... by using 
Thread.current instead of the thread-dangerous cattr_accessor
technoweenie (author)
Sat Feb 02 15:54:05 -0800 2008
commit  732ae97c4612e6495182a86c981830049b3203cc
tree    e004ea375782d3d866ba68a4703d04d916aa63c5
parent  bfdb76bac23813a53a70179baca641b11d61a324
...
1
2
 
 
 
 
 
 
 
 
3
4
5
 
6
7
8
...
1
 
2
3
4
5
6
7
8
9
10
11
 
12
13
14
15
0
@@ -1,8 +1,15 @@
0
 class CommentObserver < ArticleObserver
0
- cattr_accessor :disabled
0
+ def self.disabled?
0
+ Thread.current[:comment_observer_disabled]
0
+ end
0
+
0
+ def disabled=(value)
0
+ Thread.current[:comment_observer_disabled] = value
0
+ end
0
+
0
   def after_save(record)
0
     @event.update_attributes :title => record.article.title, :body => record.body, :site => record.article.site,
0
- :article => record.article, :author => record.author, :comment => record if record.approved? && !disabled
0
+ :article => record.article, :author => record.author, :comment => record if record.approved? && !self.class.disabled?
0
   end
0
 
0
   def after_destroy(record)
...
1
2
3
 
4
5
6
...
1
2
 
3
4
5
6
0
@@ -1,6 +1,6 @@
0
 class ApplicationController < ActionController::Base
0
   include Mephisto::CachingMethods
0
- cattr_accessor :site_count
0
+ cattr_accessor :site_count # what is this for? PDI removing
0
   before_filter :set_cache_root
0
   helper_method :site
0
   attr_reader :site
...
1
2
3
4
 
 
 
 
 
 
 
5
6
7
 
8
9
10
...
1
2
3
 
4
5
6
7
8
9
10
11
12
 
13
14
15
16
0
@@ -1,10 +1,16 @@
0
 module Mephisto
0
   module Liquid
0
     class CommentForm < ::Liquid::Block
0
- cattr_accessor :article
0
+ def self.article
0
+ Thread.current[:comment_form_article]
0
+ end
0
+
0
+ def self.article=(value)
0
+ Thread.current[:comment_form_article] = value
0
+ end
0
     
0
       def render(context)
0
- return '' unless article.accept_comments?
0
+ return '' unless self.class.article.accept_comments?
0
         result = []
0
         context.stack do
0
           if context['message'].blank?

Comments

    No one has commented yet.