Files
grecia/app/controllers/budgets_controller.rb
Javi Martín d18c627392 Add and apply Layout/EmptyLinesAfterModuleInclusion rule
This rule was added in rubocop 1.79. We were inconsistent about it, so
we're adding it to get more consistency.
2025-11-05 14:27:12 +01:00

31 lines
628 B
Ruby

class BudgetsController < ApplicationController
include FeatureFlags
include BudgetsHelper
feature_flag :budgets
before_action :load_budget, only: :show
before_action :load_current_budget, only: :index
load_and_authorize_resource
respond_to :html, :js
def show
raise ActionController::RoutingError, "Not Found" unless budget_published?(@budget)
end
def index
@finished_budgets = @budgets.finished.order(created_at: :desc)
end
private
def load_budget
@budget = Budget.find_by_slug_or_id! params[:id]
end
def load_current_budget
@budget = current_budget
end
end