Title / Description
Code class Clinics::DashboardsController < ApplicationController before_action do set_current_clinic(params[:clinic_id]) end def index if current_clinic.belongs_to?(current_user) if current_user.has_role? 'doctor', current_clinic schedule = current_clinic.schedule @doctor = current_user.doctors.where(clinic_id: current_clinic.id) @date = params[:date] ? Date.parse(params[:date]) : Date.today @slots_by_date = schedule.prep_slots(@doctor, @date) unless schedule.blank? @todays_slot = @doctor.first.slots.where('starts_at > ?', Date.today.beginning_of_day.to_time) @appointments = @todays_slot.first.appointments.page(params[:page]).per(10) unless @todays_slot.blank? end else flash.alert = "You do not have the right to visit this page." redirect_to root_path end end end
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code