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,6 +1,6 @@
class CustomersController < ApplicationController
before_action :set_company
before_action :set_customer, only: %i[ show edit update destroy ]
before_action :set_customer, only: %i[show edit update destroy]
# GET /customers or /customers.json
def index
@@ -8,8 +8,7 @@ class CustomersController < ApplicationController
end
# GET /customers/1 or /customers/1.json
def show
end
def show; end
# GET /customers/new
def new
@@ -17,8 +16,7 @@ class CustomersController < ApplicationController
end
# GET /customers/1/edit
def edit
end
def edit; end
# POST /customers or /customers.json
def create
@@ -27,7 +25,7 @@ class CustomersController < ApplicationController
respond_to do |format|
if @customer.save
format.html { redirect_to customer_url(@customer), notice: "Customer was successfully created." }
format.html { redirect_to customer_url(@customer), notice: t('.customer_created') }
format.json { render :show, status: :created, location: @customer }
else
format.html { render :new, status: :unprocessable_entity }
@@ -40,7 +38,7 @@ class CustomersController < ApplicationController
def update
respond_to do |format|
if @customer.update(customer_params)
format.html { redirect_to customer_url(@customer), notice: "Customer was successfully updated." }
format.html { redirect_to customer_url(@customer), notice: t('.customer_updated') }
format.json { render :show, status: :ok, location: @customer }
else
format.html { render :edit, status: :unprocessable_entity }
@@ -54,19 +52,20 @@ class CustomersController < ApplicationController
@customer.destroy!
respond_to do |format|
format.html { redirect_to customers_url, notice: "Customer was successfully destroyed." }
format.html { redirect_to customers_url, notice: t('.customer_destroyed') }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_customer
@customer = Customer.find(params[:id])
end
# Only allow a list of trusted parameters through.
def customer_params
params.require(:customer).permit(:name, :phone, :notes, :email, :birthyear)
end
# Use callbacks to share common setup or constraints between actions.
def set_customer
@customer = Customer.find(params[:id])
end
# Only allow a list of trusted parameters through.
def customer_params
params.require(:customer).permit(:name, :phone, :notes, :email, :birthyear)
end
end