我在使用mysql2 db在本地主机上部署时遇到语法错误,意外的keyword_end错误

时间:2011-11-10 17:33:32

标签: mysql ruby-on-rails ruby ruby-on-rails-3

部署它时出现以下错误,我很确定没有语法错误,因为它在朋友机器上运行。我不知道什么是错的或为什么我得到这个错误,但我已经坚持了近一天。因此,任何帮助将不胜感激。谢谢

显示/Users/ME/Desktop/MyRailProjects/smyes/app/views/subscribers/_form.html.erb,其中第1行引发:

/Users/ME/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.0/lib/active_record/attribute_methods/read.rb:91: syntax error, unexpected keyword_end
/Users/ME/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.0/lib/active_record/attribute_methods/read.rb:93: syntax error, unexpected $end, expecting keyword_end

提取的来源(第1行):

1: <%= form_for(@subscriber) do |f| %>
2:   <% if @subscriber.errors.any? %>
3:     <div id="error_explanation">
4:       <h2><%= pluralize(@subscriber.errors.count, "error") %> prohibited this subscriber from being saved:</h2>

1 个答案:

答案 0 :(得分:2)

它应该包含结束关键字,例如:

<%= form_for(@subscriber) do |f| %>
  <% if @subscriber.errors.any? %>
    <div id="error_explanation">
    <h2><%= pluralize(@subscriber.errors.count, "error") %> ...</h2>
  <% end %> # end for "if @subscriber.errors.any?"
<% end %> # end for "form_for(@subscriber)"

也许您部署了错误的源代码。