vendredi 13 mai 2016

Ruby rails How to compare time in search?

Hi i am working on a advance search and i want to compare requested_time to rtime using to_i.. how?

class Search < ActiveRecord::Base

def search_reservations
    reservations = Reservation.all

    reservations = reservations.where(table_id: rtable_num) if rtable_num.present?
    reservations = reservations.where(requested_date: rdate) if rdate.present?
    reservations = reservations.where(requested_time: ,rtime.to_i) if rtime.present?
    reservations
end
end

Aucun commentaire:

Enregistrer un commentaire