Hi,
I have two dates(Start and End date)in my model. How can i do a
validation such as enddate is greater than start date?
Regards,
Sandeep G
Hi,
I have two dates(Start and End date)in my model. How can i do a
validation such as enddate is greater than start date?
Regards,
Sandeep G
Sandeep G. wrote:
Hi,
I have two dates(Start and End date)in my model. How can i do a
validation such as enddate is greater than start date?Regards,
Sandeep G
before_create
check if this is higher then the other ?
On 9/10/07, Sandeep G. [email protected] wrote:
Hi,
I have two dates(Start and End date)in my model. How can i do a
validation such as enddate is greater than start date?
add your custom validation to the validate method
def validate
errors.add(:start_date, ‘must be earlier than end date’) if
self.start_date > self.end_date
end
Adam
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs