public
Description: This contains various plugins for Feather
Clone URL: git://github.com/eldiablo/feather-plugins.git
Click here to lend your support to: feather-plugins and make a donation at www.pledgie.com !
feather-plugins / feather-comments / models / comment_setting.rb
100644 19 lines (16 sloc) 0.709 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class CommentSetting
  include DataMapper::Resource
  
  property :id, Integer, :serial => true
  property :moderation, Boolean, :nullable => false, :default => false
  property :negative_captcha, Boolean, :nullable => false, :default => false
  property :email_notification, Boolean, :nullable => false, :default => false
  property :from_email, String
  property :to_email, String
  
  ##
  # This returns the current settings, creating them if they aren't found
  def self.current
    comment_settings = CommentSetting.first
    comment_settings = CommentSetting.create(:moderation => false, :negative_captcha => false, :email_notification => false) if comment_settings.nil?
    comment_settings
  end
end