1

次の 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 ステートメントから を省略すると、エラーが発生します。

4

1 に答える 1

0

今のところ私の解決策は、部分タグで明示的に使用するように CMS gem を変更し、:formats => [:html]次のように部分のフル パス (html.haml を含む) を指定することでした。

{{ cms:partial:/users/register_home_page.html.haml }}

この修正がここにあるブランチ:

https://github.com/mvcodeclub/comfortable-mexican-sofa

Githubの問題も提出しました

于 2014-11-13T03:33:50.187 に答える