lib/models.rb in cachai-0.2.7 vs lib/models.rb in cachai-0.2.8
- old
+ new
@@ -131,9 +131,13 @@
scope :comment, lambda { where(:response_type => 'comment') }
scope :pingback, lambda { where(:response_type => 'pingback') }
scope :top_level, lambda { where(:parent_id => 0) }
scope :nested, lambda { where("parent_id != 0") }
+ def parent
+ @parent ||= Response.find(parent_id) rescue nil
+ end
+
def as_json(options = {})
{
:id => id,
:author_name => author_name,
# :author_email => author_email,