Files
nairobi/app/controllers/budgets/stats_controller.rb
Julian Herrero b122302c58 Use find instead of find_by_id
Better raise a 404 HTML NotFound exception than any other unexpected error.
2019-06-03 17:54:19 +02:00

21 lines
406 B
Ruby

module Budgets
class StatsController < ApplicationController
before_action :load_budget
load_and_authorize_resource :budget
def show
authorize! :read_stats, @budget
@stats = Budget::Stats.new(@budget)
@headings = @budget.headings.sort_by_name
end
private
def load_budget
@budget = Budget.find_by_slug_or_id! params[:budget_id]
end
end
end