463e43226e
Add the #open! and #close! methods to CallForParticipation in order to provide an easy way of setting the opens_at and closes_at times.
27 lines
454 B
Ruby
27 lines
454 B
Ruby
class CallForParticipation < ActiveRecord::Base
|
|
belongs_to :conference
|
|
|
|
def open!
|
|
self.opens_at = Time.now unless self.opens_at.present?
|
|
self.closes_at = nil
|
|
save
|
|
end
|
|
|
|
def close!
|
|
self.closes_at = Time.now
|
|
save
|
|
end
|
|
|
|
def open?
|
|
self.opens_at.present? and self.opens_at < Time.now
|
|
end
|
|
|
|
def closed?
|
|
self.closes_at.present? and self.closes_at < Time.now
|
|
end
|
|
|
|
def in_progress?
|
|
open? and not closed?
|
|
end
|
|
end
|