class VaccinesController
Public Instance Methods
Source
# File app/controllers/vaccines_controller.rb, line 8 def index authorize Vaccine @vaccines = policy_scope(Vaccine).active.order(:brand) @batches_by_vaccine_id = policy_scope(Batch) .where(vaccine: @vaccines) .not_archived .order_by_number_and_expiration .group_by(&:vaccine_id) @todays_batch_id_by_programme_and_vaccine_methods = current_user.programmes.index_with do |programme| programme.vaccine_methods.index_with do |vaccine_method| todays_batch_id(programme:, vaccine_method:) end end end
Source
# File app/controllers/vaccines_controller.rb, line 28 def show @vaccine = authorize policy_scope(Vaccine).active.find(params[:id]) @batches = policy_scope(Batch).not_archived.where(vaccine: @vaccine) end