Created
August 4, 2012 13:25
-
-
Save enricostano/3257741 to your computer and use it in GitHub Desktop.
Project class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Project < ActiveRecord::Base | |
attr_accessible :name, :start, :stop, :institution_id | |
belongs_to :institution | |
validates :name, :start, :stop, :institution, :presence => true | |
validate :start_before_stop_date | |
def start_before_stop_date | |
if self.start && self.stop && self.start >= self.stop | |
self.errors.add :start, ' deve essere prima di stop' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment