2005-04-03 06:52:05 -04:00
|
|
|
class Comment < ActiveRecord::Base
|
2010-06-03 19:53:45 -04:00
|
|
|
scope :limit_by, lambda {|l| limit(l) }
|
2010-01-17 18:08:19 -05:00
|
|
|
scope :containing_the_letter_e, :conditions => "comments.body LIKE '%e%'"
|
|
|
|
scope :for_first_post, :conditions => { :post_id => 1 }
|
|
|
|
scope :for_first_author,
|
2009-08-09 19:41:36 -04:00
|
|
|
:joins => :post,
|
|
|
|
:conditions => { "posts.author_id" => 1 }
|
|
|
|
|
2008-01-26 01:23:03 -05:00
|
|
|
belongs_to :post, :counter_cache => true
|
2008-01-18 02:27:03 -05:00
|
|
|
|
2005-07-22 16:05:42 -04:00
|
|
|
def self.what_are_you
|
|
|
|
'a comment...'
|
|
|
|
end
|
2008-01-18 02:27:03 -05:00
|
|
|
|
2005-07-22 16:05:42 -04:00
|
|
|
def self.search_by_type(q)
|
2005-11-16 03:16:54 -05:00
|
|
|
self.find(:all, :conditions => ["#{QUOTED_TYPE} = ?", q])
|
2005-07-22 16:05:42 -04:00
|
|
|
end
|
2005-04-10 11:49:49 -04:00
|
|
|
end
|
|
|
|
|
2005-11-04 14:39:50 -05:00
|
|
|
class SpecialComment < Comment
|
2005-07-22 16:05:42 -04:00
|
|
|
def self.what_are_you
|
|
|
|
'a special comment...'
|
|
|
|
end
|
2005-11-04 14:39:50 -05:00
|
|
|
end
|
2005-07-22 16:05:42 -04:00
|
|
|
|
2010-10-13 06:56:15 -04:00
|
|
|
class SubSpecialComment < SpecialComment
|
|
|
|
end
|
|
|
|
|
2005-11-04 14:39:50 -05:00
|
|
|
class VerySpecialComment < Comment
|
2005-07-22 16:05:42 -04:00
|
|
|
def self.what_are_you
|
|
|
|
'a very special comment...'
|
|
|
|
end
|
2008-01-26 01:23:03 -05:00
|
|
|
end
|