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
51 lines
1.1 KiB
Ruby
51 lines
1.1 KiB
Ruby
class Admin::ValuatorGroupsController < Admin::BaseController
|
|
def index
|
|
@groups = ValuatorGroup.all.page(params[:page])
|
|
end
|
|
|
|
def show
|
|
@group = ValuatorGroup.find(params[:id])
|
|
end
|
|
|
|
def new
|
|
@group = ValuatorGroup.new
|
|
end
|
|
|
|
def edit
|
|
@group = ValuatorGroup.find(params[:id])
|
|
end
|
|
|
|
def create
|
|
@group = ValuatorGroup.new(group_params)
|
|
if @group.save
|
|
notice = t("flash.actions.create.valuator_group")
|
|
redirect_to [:admin, :valuator_groups], notice: notice
|
|
else
|
|
render :new
|
|
end
|
|
end
|
|
|
|
def update
|
|
@group = ValuatorGroup.find(params[:id])
|
|
if @group.update(group_params)
|
|
notice = t("flash.actions.update.valuator_group")
|
|
redirect_to [:admin, @group], notice: notice
|
|
else
|
|
render :edit
|
|
end
|
|
end
|
|
|
|
def destroy
|
|
@group = ValuatorGroup.find(params[:id])
|
|
@group.destroy!
|
|
notice = t("flash.actions.destroy.valuator_group")
|
|
redirect_to [:admin, :valuator_groups], notice: notice
|
|
end
|
|
|
|
private
|
|
|
|
def group_params
|
|
params.require(:valuator_group).permit(:name)
|
|
end
|
|
end
|