2014-08-06 14:47:47 +02:00
|
|
|
# Groups related to this agenda
|
2015-02-15 17:10:17 +01:00
|
|
|
class Orga < ActiveRecord::Base
|
2015-02-15 15:50:47 +01:00
|
|
|
belongs_to :region
|
2015-02-28 17:28:05 +01:00
|
|
|
belongs_to :kind
|
|
|
|
|
|
|
|
validates :kind, presence: true
|
|
|
|
validates :name, presence: true
|
|
|
|
validates :region, presence: true
|
|
|
|
validates :url, format: %r{\Ahttps?:\/\/.*\..*\z}
|
|
|
|
validates :feed, allow_blank: true, format: %r{\Ahttps?:\/\/.*\..*\z}
|
|
|
|
validates :contact, allow_blank: true, email: true
|
|
|
|
validates :submitter, allow_blank: true, email: true
|
|
|
|
|
|
|
|
before_validation on: :create do
|
|
|
|
self.submission_time = DateTime.now
|
|
|
|
self.decision_time = DateTime.now
|
|
|
|
|
|
|
|
# Populate submitter using contact info if absent
|
|
|
|
self.submitter ||= contact
|
|
|
|
end
|
2013-12-28 15:45:21 +01:00
|
|
|
end
|