Rails: time_select helper validation on previous given time? -
i know if there built-in functionality of rails time_select
, handles valid range of end_time.
i have start_time
, end_time
. end_time
not allowed "smaller" start_time
.
<%= f.time_select :start_time, {minute_step: 15}%>
how can realize this?
thank help.
it seems can't specify range via time_select
. option cut end_time
range using javascript based on start_time
value , add custom validation reliability: http://guides.rubyonrails.org/active_record_validations.html#custom-methods.
def end_time_validity if end_time < start_time errors.add(:end_time, "can't before start time") end end
Comments
Post a Comment