Model:
class QueueList < ActiveRecord::Base
has_many :times
self.today
joins(:times).where(times: { period_type: 'on', date: Date.today} || times: { period_type: 'from', date: Date.today })
end
end
The above model contains a list of times. Because :times can be in two different period_types, I have to apply an "OR" to this query. Is there a way to accomplish the above faulty code without the usage of a string query as I am trying to do in ActiveRecord?
Aucun commentaire:
Enregistrer un commentaire