我创建了一个部分用于我的 CMS 页面:
/app/views/users/_register_home_page.html.haml
我的 CMS 页面如下所示:
{{ cms:partial:/users/register_home_page }}
当我从浏览器(即 Chrome)调用它时,它工作正常。另外,当我隐身时(以确保没有发送 cookie)
从 curl 调用我的测试页面:
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|
我希望 curl 返回相同的结果。
更新:Accept: text/html
从 curl 语句中省略时会发生错误。