这是我的设置:
路线:
resources :apps, except: [:index, :new], path: 'a' do
resources :platforms, only: [:update]
end
控制器:
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
看法:
= link_to 'Update', app_platform_url(platform.app.slug, platform.id), method: :put
单击链接时,我收到以下错误:
未初始化的常量 PlatformsController
为什么 Rails 寻找PlatformsController
而不寻找Apps::PlatformsController
?