当我在 Cloud9 IDE 上运行代码时,出现下一个错误:
Missing partial submissions/_submission with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :jbuilder]}. Searched in: * "/usr/local/rvm/gems/ruby-2.3.0/gems/web-console-2.0.0.beta3/lib/action_dispatch/templates" * "/home/ubuntu/workspace/app/views" * "/usr/local/rvm/gems/ruby-2.3.0/gems/web-console-2.0.0.beta3/app/views"
我有一个提交 Controller ,我的创建代码如下:
def create
@submission = Submission.new(submission_params)
respond_to do |format|
if @submission.save
format.html { redirect_to root_path}
format.json { render :show, status: :created, location: @submission }
else
format.html { render :new }
format.json { render json: @submission.errors, status: :unprocessable_entity }
end
end
end
我不知道哪个是我的错误以及在哪里找到它。
另外,完整的堆栈文本 http://pastebin.com/YnyQeetU
index.html.erb的代码http://pastebin.com/fZbXd0Wk
最佳答案
这行代码导致了问题。
<!--<%= render @submissions %>-->
#<!-- --> This is used to comment an HTML tag
如果您不想渲染部分内容,只需将其注释掉即可,如下所示:
<%#= render @submissions %>
#<%# %> This is the way to comment embedded ruby code
关于ruby-on-rails - 缺少模板 rails ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36837064/