Ruby on rails Rails获取错误未初始化常量ApplicationController(NameError)
我得到了ApplicationBaseController的这个错误,它抛出了一个名称错误。这两个代码中是否都有错误,因为即使我从应用程序控制器中的applicationbasecontroller继承,ruby仍会抛出错误Ruby on rails Rails获取错误未初始化常量ApplicationController(NameError),ruby-on-rails,Ruby On Rails,我得到了ApplicationBaseController的这个错误,它抛出了一个名称错误。这两个代码中是否都有错误,因为即使我从应用程序控制器中的applicationbasecontroller继承,ruby仍会抛出错误 class ShoppingController < ApplicationController def index @categories = Category.all() end def new end def showcolle
class ShoppingController < ApplicationController
def index
@categories = Category.all()
end
def new
end
def showcollection
@products =Product.where(category_id: params[:id])
@productcount = Product.where(category_id: params[:id]).count
end
def create_product
@product = Product.new(product_params)
if (@product.save())
redirect_to shopping_index_path
else
render 'new'
end
end
private def product_params
params.require(:product).permit(:name,:price, :category_id, :image)
end
end
class ShoppingController
class ApplicationController
这也是我的目录结构
应该是ActionController::API吗?您是否可以发布完整的错误消息,包括堆栈跟踪,并告诉您在引发错误时做了什么(启动服务器,使用控制台,请求URL)?
class ApplicationController < ActionController::Base
end