So I am trying to nest resources under a namespace, however when i try to navigate to the UserProfile new page I am hitting the following error:
ActionController::RoutingError at /users/xxxxxx/user_profiles/new
uninitialized constant AccountManagementPages::UserProfilesController
Did you mean? AccountManagementPages::UsersController
This is how the resources are set up in my routes.rb file
constraints(AccountManagement) do
namespace :account_management_pages, path: '' do
root to: 'users#new', as: :registration
resources :users, except: %w[index], path_names: { new: 'register' } do
resources :user_profiles
end
end
end
my file structure for both my controller and views are configured correctly (at least I thought they were).
And here is how my views are nested.
This is how I have my user_profiles_controller configured:
module AccountManagementPages
module Users
class UserProfilesController < ApplicationController
def show; end
def new; end
def edit; end
def create; end
def update; end
end
end
end
and my model associations (don't think this is overly relevant here but just incase it is.)
class User < ApplicationRecord has_one :user_profile, dependent: :destroy end
class UserProfile < ApplicationRecord belongs_to :user end
any help here would be greatly appreciated. Not sure why I am hitting this error?
Thanks in advance.

