22 lines
651 B
Ruby
22 lines
651 B
Ruby
# Groups related to this agenda
|
|
class Orga < ActiveRecord::Base
|
|
belongs_to :region
|
|
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
|
|
end
|