You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 30, 2022. It is now read-only.
I'm trying to use a scope to return records based on the value of a association column. I can't seem to figure it out unfortunately.
Basically each Availability is associated with a Venue, through a Facility
Each Venue has a column called notice_time which is an integer.
I'm trying to return Availabilities where the Venue it's associated with has a notice_time that is after the current time.
class Availability < ActiveRecord::Base
belongs_to :facility
has_one :venue, through: :facility
scope :after_notice_time, -> {joins{venue}.where{start_time >= (self.venue.notice_time.hours.from_now)}}
end
I'm trying to use a scope to return records based on the value of a association column. I can't seem to figure it out unfortunately.
Basically each
Availabilityis associated with aVenue, through aFacilityEach Venue has a column called
notice_timewhich is an integer.I'm trying to return Availabilities where the Venue it's associated with has a
notice_timethat is after the current time.