Files
grecia/app/controllers/tracking/budget_investment_progress_bars_controller.rb
Javi Martín d0d681a44b Add and apply EmptyLineAfterGuardClause rule
We were inconsistent on this one. I consider it particularly useful when
a method starts with a `return` statement.

In other cases, we probably shouldn't have a guard rule in the middle of
a method in any case, but that's a different refactoring.
2019-10-24 17:56:03 +02:00

18 lines
573 B
Ruby

class Tracking::BudgetInvestmentProgressBarsController < Tracking::ProgressBarsController
before_action :restrict_access_to_assigned_items
private
def progressable
Budget::Investment.find(params[:budget_investment_id])
end
def restrict_access_to_assigned_items
return if current_user.administrator? ||
Budget::TrackerAssignment.exists?(investment_id: params[:budget_investment_id],
tracker_id: current_user.tracker.id)
raise ActionController::RoutingError.new("Not Found")
end
end