Rails 3.1.0 kaminari ActionView::Template::ajax 请求内出错?
我正在尝试使用 kaminari 在 ajax 请求中渲染分页链接,但出现服务器错误。我使用 render_to_string 方法将分页链接渲染为字符串,然后通过 json 解析它。我正在使用 Rails 3.1.0。
ActionView::Template::Error (Missing partial kaminari/paginator with {:handlers=>[:erb, :builder, :haml], :formats=>[:json], :locale=>[:en, :en]}. Searched in:
基本上,它在我的所有加载路径中寻找部分文件,但似乎找不到文件,但它们肯定在那里。
有没有人经历过类似的行为并知道可能的原因?
I'm trying to render my pagination links inside an ajax request with kaminari and im getting a server error. I'm using the render_to_string method to render the pagination links to a string then parse it via json. I'm using rails 3.1.0.
ActionView::Template::Error (Missing partial kaminari/paginator with {:handlers=>[:erb, :builder, :haml], :formats=>[:json], :locale=>[:en, :en]}. Searched in:
Basically it's looking for the partials in all my load paths and can't seem to find the files, and they're there for sure.
Has anyone experienced similar behavior and know of a possible reason?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我也刚刚遇到了这个。我可以通过将 render_to_string 移动到 respond_to 块来解决这个问题 -
I just ran into this as well. I was able to work around it by moving render_to_string into a respond_to block -
请参阅此处:http://whowish- programming.blogspot.com/2011/07/stupid-rails3-with-missing-template-and.html
只需将 .html 附加到您的视图名称即可。
See here: http://whowish-programming.blogspot.com/2011/07/stupid-rails3-with-missing-template-and.html
Just append .html to your view name.