I have an professional model and a citizen model. What i am trying to do is a nested citizen registration inside the professional model, but i am stumbling a lot...
i was using in my routes:
get "professional/citizen_edit/:id" => "professional#citizen_edit", as: :professional_citizen_edit
get "professional/cidadao_show/:id" => "professional#citizen_show", as: :professional_citizen_show
put "profissionais/cidadao_update/:id" => "professional#citizen_update", as: :professional_citizen_update
And using custom controller actions everywere And was almost done, but i had got stuck when trying to add a button for a new citizen (my form page was stuck in the update action and i cant get it to work with both actions)
While trying to solve this issue, i found this http://guides.rubyonrails.org/routing.html and this:
namespace :professionals do
resources :registrations
end
Looked a more elegant way to deal with my problem. But now i dont know what to do with the controller! I got these routes:
professionals_registrations GET /professionals/registrations(.:format) professionals/registrations#index
POST /professionals/registrations(.:format) professionals/registrations#create
new_professionals_cadastro GET /professionals/registrations/new(.:format) professionals/registrations#new
edit_professionals_cadastro GET /professionals/registrations/:id/edit(.:format) professionals/registrations#edit
professionals_cadastro GET /professionals/registrations/:id(.:format) professionals/registrations#show
PUT /professionals/registrations/:id(.:format) professionals/registrations#update
DELETE /professionals/registrations/:id(.:format) professionals/registrations#destroy
And i tried to add a custom controler "registrations" either inside app/controllers or app/controllers/professionals but i cant find the controler right path and keep getting
at: http://127.0.0.1:3000/Profissionais/registrations)
uninitialized constant Profissionais::RegistrationsController
Anyone have any clue of what to do now?