Search code examples
ruby-on-railsrubyformsroutesdevise

Ruby on Rails Routes for custom Devise Signup and Signin forms


I hope all is well. Im trying to edit sign up and sign form but my edits for the views/users/registrations and sessions directories wont take any effect. Am I doing something with the route?

Thank you

routes.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

controllers/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

enter image description here


Solution

  • From https://github.com/heartcombo/devise#configuring-views:

    All you need to do is set config.scoped_views = true inside the config/initializers/devise.rb file.