I'm trying to skip validations of a belongs_to association if a criteria is true. Below is my code
class Venue < ActiveRecord::Base
has_many :events
validates_presence_of :name, :postcode, :category
end
class Event < ActiveRecord::Base
belongs_to :venue
accepts_nested_attributes_for :venue
end
So what I need to do is skip the Venues validates_presence_of
validation if a criteria from the Events model is true. So lets say if the event_type
was equal to '1' then it will ignore the Venues validates_presence_of
call but if event_type
was '2' then it will still execute the validates_presence_of
call.