Skip to content

Commit

Permalink
Displaying all future bookings as 'currents'
Browse files Browse the repository at this point in the history
  • Loading branch information
martent committed Feb 27, 2018
1 parent 8d77f58 commit 99dc599
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions app/controllers/booking_periods_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/models/booking_period.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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, -> {
Expand Down

0 comments on commit 99dc599

Please sign in to comment.