This rule was added in rubocop 1.79. We were inconsistent about it, so we're adding it to get more consistency.
35 lines
944 B
Ruby
35 lines
944 B
Ruby
module Budgets
|
|
module Investments
|
|
class VotesController < ApplicationController
|
|
include FeatureFlags
|
|
|
|
feature_flag :remove_investments_supports, only: :destroy
|
|
|
|
load_and_authorize_resource :budget
|
|
load_and_authorize_resource :investment, through: :budget, class: "Budget::Investment"
|
|
load_and_authorize_resource through: :investment, through_association: :votes_for, only: :destroy
|
|
|
|
def create
|
|
@investment.register_selection(current_user)
|
|
|
|
respond_to do |format|
|
|
format.html do
|
|
redirect_to budget_investments_path(heading_id: @investment.heading.id),
|
|
notice: t("flash.actions.create.support")
|
|
end
|
|
|
|
format.js { render :show }
|
|
end
|
|
end
|
|
|
|
def destroy
|
|
@investment.unliked_by(current_user)
|
|
|
|
respond_to do |format|
|
|
format.js { render :show }
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|