简体   繁体   English

Rails视图帮助呈现错误的局部

[英]Rails view help renders wrong partial

I am having that problem that I am getting the wrong partial rendered. 我遇到的问题是我得到了错误的局部渲染。

Instead of rendering the partial that is located in kategoris/_konkurrencer 而不是渲染位于kategoris/_konkurrencer的局部kategoris/_konkurrencer

It is rendering the partial in public/_konkurrencer 它正在public/_konkurrencer呈现部分

My action: 我的动作:

def fast
  @titel = 'asdasd'
  @konkurrancer = Konkurrancer.where('type', 'nyhedsbrev')
  render 'kategoris/show'
end

My rails log: 我的rails日志:

Rendered public/_konkurrencer.html.erb (25.0ms)
Rendered shared/_rating.html.erb (1.0ms)
Rendered shared/_google_analytics.html.erb (1.0ms)
Rendered kategoris/show.html.erb within layouts/kategori (103.0ms)
Completed 200 OK in 231ms (Views: 139.0ms | ActiveRecord: 2.0ms)

And my kategoris/show view file: 和我的kategoris/show视图文件:

<%= render 'konkurrencer', :remote => true %>

Add the directory name: 添加目录名称:

<%= render 'kategoris/konkurrencer', :remote => true %>

Ps. 附言 You probably have a good reason to have a partial in the public folder? 您可能有充分的理由在公用文件夹中包含部分内容?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM