2011-07-23 21:55:26 +02:00
|
|
|
class Server < ActiveRecord::Base
|
2011-07-27 20:34:30 +02:00
|
|
|
|
2011-07-23 21:55:26 +02:00
|
|
|
validates_presence_of :name
|
|
|
|
belongs_to :user
|
2011-07-27 20:34:30 +02:00
|
|
|
before_save :fill_params
|
|
|
|
|
|
|
|
def self.primary
|
|
|
|
first
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def fill_params
|
|
|
|
self.port = $defaults['imap_port']
|
|
|
|
$defaults['imap_use_ssl'] == true ? self.use_ssl = 1 : self.use_ssl = 0
|
|
|
|
end
|
|
|
|
|
2011-07-23 21:55:26 +02:00
|
|
|
end
|