We only need finished budget's at budget's index "Finished budgets" section. So we add the `finished` scope to @budgets variable, and rename it so its clear what it contains. Also avoid showing the "Finished budgets" section if there is none
23 lines
599 B
Ruby
23 lines
599 B
Ruby
class BudgetsController < ApplicationController
|
|
include FeatureFlags
|
|
include BudgetsHelper
|
|
feature_flag :budgets
|
|
|
|
load_and_authorize_resource
|
|
before_action :set_default_budget_filter, only: :show
|
|
has_filters %w{not_unfeasible feasible unfeasible unselected selected}, only: :show
|
|
|
|
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)
|
|
@budget = current_budget
|
|
@budgets_coordinates = current_budget_map_locations
|
|
end
|
|
|
|
end
|