I am running Ruby (1.9.3) on Rails (3.2.0) and having a problem with the validation of virtual attributes.
I have a Flight
model that represents a fligh
I think you are going the right way with the before_validation
callback.
You can validate virtual attributes like every normal attribute. So all you need is just some validation in the model. Try this:
validates :departure_airport, presence: true
validates :arrival_airport, presence: true
this should add an error to the objects errors and the error should be displayed in your form...