作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在Heroku托管的Ruby on Rails 3.2.13应用程序中遇到了一个奇怪的错误,该错误无法在本地复制,也无法确定原因。
以下是症状:
在几页上,我看到了可怕的“很抱歉,但出了点问题”错误:
日志表明存在模板错误:
Started GET "/users/sign_in" for 107.203.222.41 at 2013-05-27 13:45:18 +0000
ActionView::Template::Error (syntax error on line 6, col 15: `'):
15: <%= f.password_field :password %></div>
16:
21: <div><%= f.submit "Sign in" %></div>
19: <% end -%>
17: <% if devise_mapping.rememberable? -%>
18: <div><%= f.check_box :remember_me %> <%= f.label :remember_me %></div>
app/views/devise/sessions/new.html.erb:8:in `_app_views_devise_sessions_new_html_erb__2053461519121638579_44147620'
app/views/devise/sessions/new.html.erb:18:in `block in _app_views_devise_sessions_new_html_erb__2053461519121638579_44147620'
20:
Started GET "/blog" for 107.203.222.41 at 2013-05-27 13:36:10 +0000
ActionView::Template::Error (syntax error on line 6, col 15: `'):
10: <%= render :partial => "post", :collection => @posts %>
13: <% end %>
9: <%= content_tag(:div, :id => 'blog_content') do %>
11:
12: <%= will_paginate @posts, :page_links => false %>
14:
15: <%= render 'sidebar' %>
app/views/posts/blog.html.erb:12:in `block (2 levels) in _app_views_posts_blog_html_erb___3437273290190956225_40741600'
app/views/posts/blog.html.erb:9:in `block in _app_views_posts_blog_html_erb___3437273290190956225_40741600'
app/views/posts/blog.html.erb:7:in `_app_views_posts_blog_html_erb___3437273290190956225_40741600'
<% if devise_mapping.rememberable? -%>
<div>
<%= f.check_box :remember_me %>
<%#= f.label :remember_me %>
</div>
<% end -%>
<%= form_for(resource, :as => resource_name, :url => session_url(resource_name), :autocomplete => 'off') do |f| %>
<div>
<%= f.check_box :remember_me %>
<%#= f.label :remember_me %>
</div>
<% end %>
ActionView::Template::Error (syntax error on line 6, col 15: `')
最佳答案
原来这是en.yml中的YAML问题。
具体来说,YAML最初是:
# Sample localization file for English. Add more files in this directory for other locales.
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
en:
activerecord:
models:
attributes:
syntax error on line 6, col 15: `'
# Sample localization file for English. Add more files in this directory for other locales.
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
en:
hello: "Hello world"
关于ruby-on-rails - Heroku语法错误;日志包含加扰的行号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16774903/
我是一名优秀的程序员,十分优秀!