我的“个人档案”控制器上有一个“未初始化的常量ProfilesController”错误。这是profiles_controller.rb:未初始化的常量ProfilesController
class ProfilesController < ApplicationController
def new
@profile = Profile.new
end
def create
@profile = Profile.new(params[:profile])
if @profile.save
redirect_to profile_path, notice: I18n.t('.profile.created')
else
render action: "new"
end
end
end
这是routes.rb中:
resources :profiles, only: [:new, :create]
耙路线,它的输出:
profiles POST /profiles(.:format) profiles#create
new_profile GET /profiles/new(.:format) profiles#new
当我点击一个链接“ new_profile_path“我得到的错误,但对我来说一切似乎都没问题?控制器名称是复数,路线是否正常?
难道您是手动创建控制器还是使用脚手架?之前手动创建控制器时,我遇到了类似的行为。 – BrMcMullin 2013-04-10 19:23:16
手动,bt当它不工作也与发电机。两者都有同样的问题。 – John 2013-04-11 05:45:37