Loading app/models/day.rb +4 −15 Original line number Diff line number Diff line Loading @@ -2,27 +2,16 @@ class Day < ActiveRecord::Base include HumanizedDateRange belongs_to :conference # TODO a new day should search matching availabilities without a day: # in case someone deletes a day, availabilities need to persist, # so they can be reclaimed by a new day later # if a.day_id.nil? # on_create(day) # conference.availabilities.each { |a| # next unless a.day_id = nil # a.day_id = @conference.days.map { |day| day.id # if a.start_time.between?(day.start_date, day.end_date) # or a.end_time.between?(day.start_date, day.end_date) # or day.start_date.between?(a.start_time, a.end_time) } has_many :availabilities has_paper_trail meta: {associated_id: :conference_id, associated_type: "Conference"} default_scope { order(start_date: :asc) } validates_presence_of :start_date, message: "missing start date" validates_presence_of :end_date, message: "missing end date" validate :start_date_before_end_date, message: "failed validation" validate :does_not_overlap, message: "overlaps, failed validation" validates :start_date, presence: true validates :end_date, presence: true validate :start_date_before_end_date validate :does_not_overlap def start_date_before_end_date self.errors.add(:end_date, "should be after start date") if self.start_date >= self.end_date Loading app/models/event_feedback.rb +1 −1 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ class EventFeedback < ActiveRecord::Base after_save :update_average validates_presence_of :rating, message: "please select a value" validates_presence_of :rating protected Loading app/models/event_rating.rb +1 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ class EventRating < ActiveRecord::Base after_save :update_average validates_presence_of :rating, message: "rating score was missing" validates_presence_of :rating validates :event, presence: true validates :person, presence: true Loading app/models/notification.rb +1 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ class Notification < ActiveRecord::Base validates :reject_body, presence: true validates :accept_body, presence: true validates :accept_subject, presence: true validate :uniq_locale, message: "this locale already exists for this call for papers" validate :uniq_locale # TODO #validate :locale_is_valid Loading Loading
app/models/day.rb +4 −15 Original line number Diff line number Diff line Loading @@ -2,27 +2,16 @@ class Day < ActiveRecord::Base include HumanizedDateRange belongs_to :conference # TODO a new day should search matching availabilities without a day: # in case someone deletes a day, availabilities need to persist, # so they can be reclaimed by a new day later # if a.day_id.nil? # on_create(day) # conference.availabilities.each { |a| # next unless a.day_id = nil # a.day_id = @conference.days.map { |day| day.id # if a.start_time.between?(day.start_date, day.end_date) # or a.end_time.between?(day.start_date, day.end_date) # or day.start_date.between?(a.start_time, a.end_time) } has_many :availabilities has_paper_trail meta: {associated_id: :conference_id, associated_type: "Conference"} default_scope { order(start_date: :asc) } validates_presence_of :start_date, message: "missing start date" validates_presence_of :end_date, message: "missing end date" validate :start_date_before_end_date, message: "failed validation" validate :does_not_overlap, message: "overlaps, failed validation" validates :start_date, presence: true validates :end_date, presence: true validate :start_date_before_end_date validate :does_not_overlap def start_date_before_end_date self.errors.add(:end_date, "should be after start date") if self.start_date >= self.end_date Loading
app/models/event_feedback.rb +1 −1 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ class EventFeedback < ActiveRecord::Base after_save :update_average validates_presence_of :rating, message: "please select a value" validates_presence_of :rating protected Loading
app/models/event_rating.rb +1 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ class EventRating < ActiveRecord::Base after_save :update_average validates_presence_of :rating, message: "rating score was missing" validates_presence_of :rating validates :event, presence: true validates :person, presence: true Loading
app/models/notification.rb +1 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ class Notification < ActiveRecord::Base validates :reject_body, presence: true validates :accept_body, presence: true validates :accept_subject, presence: true validate :uniq_locale, message: "this locale already exists for this call for papers" validate :uniq_locale # TODO #validate :locale_is_valid Loading