Class: Setting
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Setting
- Includes:
- SettingsHelper
- Defined in:
- app/models/setting.rb
Overview
@Name :Setting model
@Created at :19-06-2012
@Updated at :20-06-2012
@Purpose :Needed for initailizing activerecord for mcms_settings table in rails
@Company :Mindfire Solutions
Class Method Summary collapse
-
.blog_commentable_setting ⇒ Object
make settings for blogs to be commentable by updating attribute value to 1.
-
.blog_moderatable_setting ⇒ Object
make settings for blogs to be moderatable by updating attribute value to 1.
-
.blog_uncommentable_setting ⇒ Object
make settings for blogs to be uncommentable by updating attribute value to 0.
-
.blog_unmoderatable_setting ⇒ Object
make settings for blogs to be unmoderatable by updating attribute value to 0.
-
.find_notification_recipient ⇒ Object
Finding notification recipients emails.
-
.notification_recipient ⇒ Object
retrieve notification_recipient email.
-
.set_notification_recipient(emails) ⇒ Object
Setting notification recipients emails.
Methods included from SettingsHelper
#blog_posts_per_page, commentable, moderatable, uncommentable, unmoderatable
Class Method Details
.blog_commentable_setting ⇒ Object
make settings for blogs to be commentable by updating attribute value to 1
25 26 27 |
# File 'app/models/setting.rb', line 25 def self.blog_commentable_setting self.find_by_name('comment_allowed').update_attribute(:value, SettingsHelper.commentable) end |
.blog_moderatable_setting ⇒ Object
make settings for blogs to be moderatable by updating attribute value to 1
35 36 37 |
# File 'app/models/setting.rb', line 35 def self.blog_moderatable_setting self.find_by_name('comment_moderation').update_attributes(:value => SettingsHelper.moderatable) end |
.blog_uncommentable_setting ⇒ Object
make settings for blogs to be uncommentable by updating attribute value to 0
20 21 22 |
# File 'app/models/setting.rb', line 20 def self.blog_uncommentable_setting self.find_by_name('comment_allowed').update_attribute(:value, SettingsHelper.uncommentable) end |
.blog_unmoderatable_setting ⇒ Object
make settings for blogs to be unmoderatable by updating attribute value to 0
30 31 32 |
# File 'app/models/setting.rb', line 30 def self.blog_unmoderatable_setting self.find_by_name('comment_moderation').update_attributes(:value => SettingsHelper.unmoderatable) end |
.find_notification_recipient ⇒ Object
Finding notification recipients emails.
55 56 57 |
# File 'app/models/setting.rb', line 55 def self.find_notification_recipient self.find_by_name('notification_recipient').value end |
.notification_recipient ⇒ Object
retrieve notification_recipient email
40 41 42 43 44 45 46 47 |
# File 'app/models/setting.rb', line 40 def self.notification_recipient email_id = self.find_by_name('notication_recipient').email if email_id.present? return email_id else return User.first.email end end |
.set_notification_recipient(emails) ⇒ Object
Setting notification recipients emails.
50 51 52 |
# File 'app/models/setting.rb', line 50 def self.set_notification_recipient(emails) self.find_by_name('notification_recipient').update_attributes(:value => emails) end |