Created
June 1, 2017 19:15
-
-
Save mh-github/b0384aa39a325123b6b2c7e4dd92c2c8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Travel < ActiveRecord::Base | |
| belongs_to :expenses_claim | |
| has_many :travel_expenses | |
| accepts_nested_attributes_for :travel_expenses, allow_destroy: true | |
| validates :end_date, presence: true, date: { :after_or_equal_to => :start_date, message: "must be after or equal to start date."} | |
| validates :end_date, presence: true, date: { :before_or_equal_to => Proc.new { Time.now }, message: "must be today #{(Date.today).to_s} or before." }, on: :create | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment