简体   繁体   English

Buffalo v0.11.0是否与flash和application.html有关?

[英]Buffalo v0.11.0 issues with flash and application.html?

I am a beginner at using Golang and Buffalo. 我是使用Golang和Buffalo的初学者。 I am trying to create a password authentication service using the authrecipe from https://github.com/gobuffalo/authrecipe . 我正在尝试使用来自https://github.com/gobuffalo/authrecipe的authrecipe创建密码身份验证服务。 However, upon trying to run this using buffalo dev , I am receiving the following error from the JSON dump: 但是,尝试使用buffalo dev运行它时,我从JSON转储中收到以下错误:

ERRO[2018-05-10T14:20:48-04:00] application.html: line 14: _flash.html: 

line 3: flash: unknown identifier content_type=text/html db="0s" duration="5.354757ms" human_size="0 B" method=GET params="{}" path=/ render="659.229µs" request_id="fa1ad5b329-b4e23f788b" size="0" status="0"

In line 14 application.html file, there is a reference to the flash folder, and in line 3 of my _flash.html file, there is a variable called flash. 在第14行application.html文件中,有一个对flash文件夹的引用,在我的_flash.html文件的第3行中,有一个名为flash的变量。 Has anyone else received this error? 还有其他人收到此错误吗? How did you fix it? 你怎么修好它的? I have tried to delete the flash command, but that did not resolve the problem and the same error kept appearing. 我试图删除flash命令,但是并不能解决问题,并且始终出现相同的错误。

application.html code: application.html代码:

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta charset="utf-8">
    <title>Buffalo - Coke</title>
    <%= stylesheetTag("application.css") %>
    <meta name="csrf-param" content="authenticity_token" />
    <meta name="csrf-token" content="<%= authenticity_token %>" />
    <link rel="icon" href="<%= assetPath("images/favicon.ico") %>">
  </head>
  <body>

    <div class="container">
      <%= yield %>
    </div>

    <%= javascriptTag("application.js") %>
  </body>
</html>

_flash.html code: _flash.html代码:

<div class="row">
  <div class="col-md-12">
    <%= for (k, messages) in flash { %>
      <%= for (msg) in messages { %>
        <div class="alert alert-<%= k %>" role="alert">
            <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <%= msg %>
        </div>
      <% } %>
    <% } %>
  </div>
</div>

There was a breaking change in the Plush templating engine v4.5.7 (the one used by Buffalo by default). Plush模板引擎v4.5.7(Buffalo默认使用的版本) 发生重大变化 Buffalo v0.11.1 was released to address this issue, so if you upgrade buffalo to v0.11.1, it should work fine. 发布了Buffalo v0.11.1以解决此问题,因此,如果将buffalo升级到v0.11.1,它应该可以正常工作。

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

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