I know there was a few questions like that but I couldn't find my case. I check that web site as well: https://github.com/bitmakerlabs/debugging-guide/wiki/Rails-error:-Routing-Error:-uninitialized-constant and it looks like it should work. Cannot find where is the problem.
Error looks like:
uninitialized constant ProfileController
In my app/controllers folder I have profiles_controller.rb file:
class ProfilesController < ApplicationController
# GET to /users/:user_id/profile/new
def new
# Render blank profile details form
end
end
I have a view file under app/views/profiles/new.html.erb and link to it with <%= link_to "Create your profile!", new_user_profile_path(user_id: current_user.id) if user_signed_in? %>. In my routes I have:
new_user_profile_path GET /users/:user_id/profile/new(.:format)
profile#new
Could you direct me to an error? Every answer I could find relates to naming while mine looks fine to me (profiles_controller.rb and ProfilesController class). Am I missing something obvious?
EDIT:
my routes.rb file snippet for profiles:
resources :users do
resources :profile
end
EDIT 2:
In my project one user may have only one profile. It makes more sense to have route ...user/profile/... than ...user/profiles/...
routes.rbfile's snippet forresource :users? - Anurag Aryan