[英]Missing partial when using curl for ComfortableMexicanSofa page
I've created a partial for use in my CMS page at: 我在以下位置的CMS页面中创建了供我使用的部分内容:
/app/views/users/_register_home_page.html.haml
My CMS page looks like this: 我的CMS页面如下所示:
{{ cms:partial:/users/register_home_page }}
When I call this from the browser (ie, Chrome) it works fine. 当我从浏览器(即Chrome)中调用它时,它可以正常工作。 Also when I go incognito (to ensure there's no cookies being sent)
另外,当我进入隐身模式(以确保没有发送Cookie时)
calling my test page from curl: 从curl调用我的测试页:
curl "http://localhost:5000/test"
returns curl "http://localhost:5000/test"
返回
ActionView::MissingTemplate at /
================================
> Missing partial users/_register_home_page with {:locale=>[:en], :formats=>[:all], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :haml]}. Searched in:
* "/Users/doug/dev/my-rails-app/app/views"
actionview (4.1.7) lib/action_view/path_set.rb, line 46
-------------------------------------------------------
41 end
42 METHOD
43 end
44
45 def find(*args)
> 46 find_all(*args).first || raise(MissingTemplate.new(self, *args))
47 end
48
49 def find_all(path, prefixes = [], *args)
50 prefixes = [prefixes] if String === prefixes
51 prefixes.each do |prefix|
I'd expect curl to return the same results. 我希望curl返回相同的结果。
Update: The error occurs when Accept: text/html
is ommitted from the curl statement. 更新:在curl语句中省略“
Accept: text/html
时,发生错误。
My solution for now was to modify the CMS gem to explicitly use :formats => [:html]
in the partial tag, and then specify the full path (including html.haml) of the partial like so: 我现在的解决方案是修改CMS gem,以在部分标记中明确使用
:formats => [:html]
,然后指定部分的完整路径(包括html.haml),如下所示:
{{ cms:partial:/users/register_home_page.html.haml }}
A branch where this fix is here: 此修复程序在这里的分支:
https://github.com/mvcodeclub/comfortable-mexican-sofa https://github.com/mvcodeclub/comfortable-mexican-sofa
I've also filed a Github issue 我也提交了Github问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.