Ruby on Rails Routes สำหรับแบบฟอร์มลงทะเบียนและลงชื่อเข้าใช้ Devise แบบกำหนดเอง

ฉันหวังว่าทั้งหมดเป็นอย่างดี. ฉันกำลังพยายามแก้ไขแบบฟอร์มลงทะเบียนและลงชื่อ แต่การแก้ไขไดเร็กทอรี view/users/registration และ sessions จะไม่เกิดผลใดๆ ฉันกำลังทำอะไรกับเส้นทางหรือไม่?

ขอบคุณ

เส้นทาง.rb

Rails.application.routes.draw do
  devise_for :users
  resources :users
  get 'users/index'
  match '/users', to: 'users#index', via: 'get'
  match '/users/:id', to: 'users#show', via: 'get'

  root to: "pages#home"
end

ตัวควบคุม/users_controller.rb

class UsersController < ApplicationController
  def index
    @users = User.all
  end

  def new

  end

  def show
    @user = User.find_by_id(params[:id])
  end

  def edit
    @user = User.find_by_id(params[:id])
  end

end

ป้อนคำอธิบายรูปภาพที่นี่


person Designer    schedule 23.09.2020    source แหล่งที่มา


คำตอบ (1)


จาก https://github.com/heartcombo/devise#configuring-views:

สิ่งที่คุณต้องทำคือตั้งค่า config.scoped_views = true ภายในไฟล์ config/initializers/devise.rb

person Sergey Alekseev    schedule 23.09.2020
comment
อ่า แค่นั้นแหละ! ขอบคุณ! ฉันเสียเวลาทั้งวันเพื่อสิ่งนี้! - person Designer; 23.09.2020
comment
@Designer ยินดีที่จะช่วยเหลือในเรื่องง่าย ๆ นี้ :) จริง ๆ แล้วคำตอบแรกของฉันเกี่ยวกับ SO เกี่ยวข้องกับ Ruby on Rails มาหลายปีแล้ว บางทีฉันควรช่วยเหลือผู้คนให้บ่อยขึ้น - person Sergey Alekseev; 23.09.2020
comment
ใช่ โปรดทำเช่นนั้น! อาจดูเรียบง่ายและชัดเจนสำหรับคุณ แต่สำหรับบางคนอาจใช้เวลานานหลายชั่วโมง ถ้าไม่ใช่หลายวัน... อยู่อย่างปลอดภัยนะเพื่อน! - person Designer; 23.09.2020