Domains#index is now the root page

This commit is contained in:
2023-06-21 17:23:20 +01:00
parent d882c1a521
commit b1009ec4de
8 changed files with 45 additions and 12 deletions

View File

@@ -1,6 +1,6 @@
class CredentialsController < ApplicationController
before_action :set_credential, only: %i[ show edit update destroy ]
before_action :set_domain, only: %i[ new ]
before_action :set_domain, only: %i[ new create edit update destroy ]
# GET /credentials or /credentials.json
def index
@@ -23,10 +23,11 @@ class CredentialsController < ApplicationController
# POST /credentials or /credentials.json
def create
@credential = Credential.new(credential_params)
@credential.domain_id = @domain.id
respond_to do |format|
if @credential.save
format.html { redirect_to credential_url(@credential), notice: "Credential was successfully created." }
format.html { redirect_to domain_path(@domain), notice: "Credential was successfully created." }
format.json { render :show, status: :created, location: @credential }
else
format.html { render :new, status: :unprocessable_entity }
@@ -39,7 +40,7 @@ class CredentialsController < ApplicationController
def update
respond_to do |format|
if @credential.update(credential_params)
format.html { redirect_to credential_url(@credential), notice: "Credential was successfully updated." }
format.html { redirect_to domain_path(@domain), notice: "Credential was successfully updated." }
format.json { render :show, status: :ok, location: @credential }
else
format.html { render :edit, status: :unprocessable_entity }
@@ -53,7 +54,7 @@ class CredentialsController < ApplicationController
@credential.destroy
respond_to do |format|
format.html { redirect_to credentials_url, notice: "Credential was successfully destroyed." }
format.html { redirect_to domain_path(@domain), notice: "Credential was successfully destroyed." }
format.json { head :no_content }
end
end