We were very inconsistent regarding these rules. Personally I prefer no empty lines around blocks, clases, etc... as recommended by the Ruby style guide [1], and they're the default values in rubocop, so those are the settings I'm applying. The exception is the `private` access modifier, since we were leaving empty lines around it most of the time. That's the default rubocop rule as well. Personally I don't have a strong preference about this one. [1] https://rubystyle.guide/#empty-lines-around-bodies
42 lines
774 B
Ruby
42 lines
774 B
Ruby
class Admin::ProposalsController < Admin::BaseController
|
|
include HasOrders
|
|
include CommentableActions
|
|
include FeatureFlags
|
|
feature_flag :proposals
|
|
helper DownloadSettingsHelper
|
|
|
|
has_orders %w[created_at]
|
|
|
|
before_action :load_proposal, except: :index
|
|
|
|
def show
|
|
end
|
|
|
|
def update
|
|
if @proposal.update(proposal_params)
|
|
redirect_to admin_proposal_path(@proposal), notice: t("admin.proposals.update.notice")
|
|
else
|
|
render :show
|
|
end
|
|
end
|
|
|
|
def toggle_selection
|
|
@proposal.toggle :selected
|
|
@proposal.save!
|
|
end
|
|
|
|
private
|
|
|
|
def resource_model
|
|
Proposal
|
|
end
|
|
|
|
def load_proposal
|
|
@proposal = Proposal.find(params[:id])
|
|
end
|
|
|
|
def proposal_params
|
|
params.require(:proposal).permit(:selected)
|
|
end
|
|
end
|