I want to use devise to edit within the show page of a User

165 views Asked by At

In my show page for my User I have a edit profile tab that is contained in the profile. I made a Devise controller that I build custom routes with. My issue is now when im within 'users/show/:id' it shows the edit page. Should I copy the devise edit page view to my show view?

My routes.rb is set like so.

Rails.application.routes.draw do
  devise_scope :teacher do
    get "/teachers/:id" => "devise/registrations#edit" #removed

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

This is my controller

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

A visual of what I am trying to do is belowenter image description here

As you can see I have a tab set up to edit the proDfile in page. Do I just copy the edit view into the fields of the show where I created the edit tab?

UPDATE

As I render the form into the show page it gives me this error.

ActionView::MissingTemplate in Teachers#show
Showing /home/malik/Desktop/NYCDA/docs/week9/teachers-pet/app/views/teachers/show.html.erb where line #163 raised:

Missing partial devise/registrations/_edit with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :coffee, :jbuilder]}. Searched in:
0

There are 0 answers