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