Here is my setup:
Routes:
resources :apps, except: [:index, :new], path: 'a' do
resources :platforms, only: [:update]
end
Controller:
class Apps::PlatformsController < ApplicationController
before_action :authenticate_user!
before_action :set_platform
# PATCH/PUT /apps/1/platforms/1
# PATCH/PUT /apps/1/platforms/1.json
def update
# do stuff ...
end
private
# Use callbacks to share common setup or constraints between actions.
def set_platform
@platform = App::Platform.find params[:id]
end
end
View:
= link_to 'Update', app_platform_url(platform.app.slug, platform.id), method: :put
When clicking the link, I get the following error:
uninitialized constant PlatformsController
Why does Rails look for PlatformsController
and not Apps::PlatformsController
?
As far as I know just namespace
s and scope
s require a nested module.