From 99dc5994510186353d3f66c898edbe1a5a3f54ab Mon Sep 17 00:00:00 2001 From: martent Date: Tue, 27 Feb 2018 11:20:37 +0100 Subject: [PATCH] Displaying all future bookings as 'currents' --- app/controllers/booking_periods_controller.rb | 3 +-- app/models/booking_period.rb | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/controllers/booking_periods_controller.rb b/app/controllers/booking_periods_controller.rb index 8134e87..d296469 100644 --- a/app/controllers/booking_periods_controller.rb +++ b/app/controllers/booking_periods_controller.rb @@ -2,8 +2,7 @@ class BookingPeriodsController < ApplicationController before_action :set_booking_period, only: [:show, :edit, :update, :destroy] def index - # @booking_periods = BookingPeriod.all - @booking_periods = BookingPeriod.currents.or(BookingPeriod.bookables) + @booking_periods = BookingPeriod.currents end def show diff --git a/app/models/booking_period.rb b/app/models/booking_period.rb index 109a313..ceb6b82 100644 --- a/app/models/booking_period.rb +++ b/app/models/booking_period.rb @@ -6,7 +6,7 @@ class BookingPeriod < ApplicationRecord :booking_starts_at, :booking_ends_at scope :currents, -> { - where('starts_at <= ? and ends_at >= ?', Date.today, Date.today) + where('ends_at >= ?', Date.today) } scope :bookables, -> {