Updated to Rails 7.0.5.1

This commit is contained in:
2023-06-28 15:01:01 +01:00
parent b1009ec4de
commit 31e1311fe6
10 changed files with 171 additions and 141 deletions

View File

@@ -1,6 +1,6 @@
class VirtualsController < ApplicationController
before_action :set_virtual, only: %i[ show edit update destroy ]
before_action :set_domain, only: %i[ new create edit update destroy ]
# GET /virtuals or /virtuals.json
def index
@virtuals = Virtual.all
@@ -22,10 +22,11 @@ class VirtualsController < ApplicationController
# POST /virtuals or /virtuals.json
def create
@virtual = Virtual.new(virtual_params)
@virtual.domain_id = @domain.id
respond_to do |format|
if @virtual.save
format.html { redirect_to virtual_url(@virtual), notice: "Virtual was successfully created." }
format.html { redirect_to domain_url(@domain), notice: "Virtual was successfully created." }
format.json { render :show, status: :created, location: @virtual }
else
format.html { render :new, status: :unprocessable_entity }
@@ -38,7 +39,7 @@ class VirtualsController < ApplicationController
def update
respond_to do |format|
if @virtual.update(virtual_params)
format.html { redirect_to virtual_url(@virtual), notice: "Virtual was successfully updated." }
format.html { redirect_to domain_url(@domain), notice: "Virtual was successfully updated." }
format.json { render :show, status: :ok, location: @virtual }
else
format.html { render :edit, status: :unprocessable_entity }
@@ -52,7 +53,7 @@ class VirtualsController < ApplicationController
@virtual.destroy
respond_to do |format|
format.html { redirect_to virtuals_url, notice: "Virtual was successfully destroyed." }
format.html { redirect_to domain_url(@domain), notice: "Virtual was successfully destroyed." }
format.json { head :no_content }
end
end
@@ -63,6 +64,10 @@ class VirtualsController < ApplicationController
@virtual = Virtual.find(params[:id])
end
def set_domain
@domain = Domain.find(params[:domain_id])
end
# Only allow a list of trusted parameters through.
def virtual_params
params.require(:virtual).permit(:email, :destination)