diff options
author | Philip Arndt <parndt@gmail.com> | 2010-08-28 18:15:53 +1200 |
---|---|---|
committer | Philip Arndt <parndt@gmail.com> | 2010-08-28 18:15:53 +1200 |
commit | 21dca99ddf7eadb929bc9fe40a6b3f9fd90b2f41 (patch) | |
tree | 920043fe637f02bde2ca7a41b9c714e6fd7633f1 /app/models | |
parent | e6fead06dcc6c27e47df83533b53256beabc21a5 (diff) | |
download | refinerycms-blog-21dca99ddf7eadb929bc9fe40a6b3f9fd90b2f41.tar.gz refinerycms-blog-21dca99ddf7eadb929bc9fe40a6b3f9fd90b2f41.tar.bz2 refinerycms-blog-21dca99ddf7eadb929bc9fe40a6b3f9fd90b2f41.zip |
wrote rails engine for later, added ability to add comments and see ones already posted.
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/blog_comment.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/app/models/blog_comment.rb b/app/models/blog_comment.rb index 28139e7..cc890fa 100644 --- a/app/models/blog_comment.rb +++ b/app/models/blog_comment.rb @@ -1,8 +1,18 @@ class BlogComment < ActiveRecord::Base + filters_spam :author_field => :name, + :email_field => :email, + :message_field => :message + belongs_to :post, :class_name => 'BlogPost' - acts_as_indexed :fields => [:name, :email, :body] + acts_as_indexed :fields => [:name, :email, :message] + + alias_attribute :message, :body + + validates_presence_of :name, :message + validates_format_of :email, + :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i named_scope :unmoderated, :conditions => {:state => nil} named_scope :approved, :conditions => {:state => 'approved'} |