Rubocop rules

This commit is contained in:
Nedim
2025-02-17 19:12:40 +01:00
parent ef01db0700
commit ee89170c32
42 changed files with 1043 additions and 267 deletions

View File

@@ -1,5 +1,5 @@
class CompaniesController < ApplicationController
before_action :set_company, only: %i[ show edit update destroy ]
before_action :set_company, only: %i[show edit update destroy]
# GET /companies or /companies.json
def index
@@ -7,8 +7,7 @@ class CompaniesController < ApplicationController
end
# GET /companies/1 or /companies/1.json
def show
end
def show; end
# GET /companies/new
def new
@@ -16,8 +15,7 @@ class CompaniesController < ApplicationController
end
# GET /companies/1/edit
def edit
end
def edit; end
# POST /companies or /companies.json
def create
@@ -25,7 +23,7 @@ class CompaniesController < ApplicationController
respond_to do |format|
if @company.save
format.html { redirect_to company_url(@company), notice: "Company was successfully created." }
format.html { redirect_to company_url(@company), notice: t('.company_created') }
format.json { render :show, status: :created, location: @company }
else
format.html { render :new, status: :unprocessable_entity }
@@ -38,7 +36,7 @@ class CompaniesController < ApplicationController
def update
respond_to do |format|
if @company.update(company_params)
format.html { redirect_to company_url(@company), notice: "Company was successfully updated." }
format.html { redirect_to company_url(@company), notice: t('.company_updated') }
format.json { render :show, status: :ok, location: @company }
else
format.html { render :edit, status: :unprocessable_entity }
@@ -52,19 +50,30 @@ class CompaniesController < ApplicationController
@company.destroy!
respond_to do |format|
format.html { redirect_to companies_url, notice: "Company was successfully destroyed." }
format.html { redirect_to companies_url, notice: t('.company_destroyed') }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_company
@company = Company.find(params[:id])
end
# Only allow a list of trusted parameters through.
def company_params
params.require(:company).permit(:name, :id_number, :vat_number, :address_line_one, :address_line_two, :postal_code, :city, :entity, :country)
end
# Use callbacks to share common setup or constraints between actions.
def set_company
@company = Company.find(params[:id])
end
# Only allow a list of trusted parameters through.
def company_params
params.require(:company).permit(
:name,
:id_number,
:vat_number,
:address_line_one,
:address_line_two,
:postal_code,
:city,
:entity,
:country
)
end
end