Custom validation and presence validation

Code in my model is

validates :place_id, :title, :level, :start_at, :end_at, :presence =>
validate :event_takes_place_in_one_day, :event_is_not_in_past

def event_takes_place_in_one_day ==
def event_is_not_in_past
admissible_range =…
admissible_range.cover?(self.start_at) &&

I need to validate presence of start_at and end_at before my custom
validations, but this do not happen, here is the errors that I got

undefined method `to_datetime’ for nil:NilClass

app/models/meeting.rb:22:in cover?' app/models/meeting.rb:22:inevent_is_not_in_past’
app/controllers/meetings_controller.rb:18:in `create’

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs