public
Description: The open source social networking platform in Ruby on Rails from the author of RailsSpace
Homepage: http://insoshi.com
Clone URL: git://github.com/insoshi/insoshi.git
Search Repo:
Michael Hartl (author)
Fri May 09 10:48:27 -0700 2008
commit  2838ad9b69f465d313c496f2a9a3f38328f6e762
tree    893d5808367714b6c112efa597673d10045831f9
parent  7cd47c9b7ebc130b0a8d394f22578b37a7753640 parent  39a30c4b375eb8356345f91be34ec409d15d8481
insoshi / app / models / preference.rb
100644 32 lines (27 sloc) 0.992 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# == Schema Information
# Schema version: 20
#
# Table name: preferences
#
# id :integer(11) not null, primary key
# domain :string(255) default(""), not null
# smtp_server :string(255) default(""), not null
# email_notifications :boolean(1) not null
# email_verifications :boolean(1) not null
# created_at :datetime
# updated_at :datetime
# analytics :text
# server_name :string(255)
# app_name :string(255)
#
 
class Preference < ActiveRecord::Base
  attr_accessible :app_name, :server_name, :domain, :smtp_server,
                  :email_notifications, :email_verifications, :analytics,
                  :about
 
  validates_presence_of :domain, :if => :using_email?
  validates_presence_of :smtp_server, :if => :using_email?
  
  private
  
    def using_email?
      email_notifications? or email_verifications?
    end
end