使编辑路径与Devise中的显示页面相同

时间:2017-08-31 21:52:20

标签: ruby-on-rails devise

在我的观看次数的个人资料页面中,我创建了一个编辑个人资料标签,以便用户可以在展示页面中编辑个人资料。我正在使用自定义Devise控制器,但我不知道如何处理编辑路径与显示页面相同。

这是我的控制器

 class Teachers::RegistrationsController < Devise::RegistrationsController
      # before_action :configure_sign_up_params, only: [:create],
      # before_action :configure_account_update_params, only: [:update]

  #GET /resource/sign_up
   def new
     super
   end

   def sign_up_params
        params.require(:teacher).permit(:name, :avatar, :email, :password)
   end

   #POST /resource/
   def create
    super
  end

  # GET /resource/edit
  def edit
     super
   end

这是我的路线

Rails.application.routes.draw do
  devise_for :teachers, controllers: { registrations: 'teachers/registrations' }
  # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html

root to: "teachers#index"
resources :teachers
resources :students
resources :courses
resources :behavior_reports
resources :participation_reports
resources :grades
resources :parents
resources :attendances

end

0 个答案:

没有答案