我显示以下错误,不知道出了什么问题......
/home/ubuntu/section3/alpha-blog/app/views/users/_form.html.erb:39: syntax error, unexpected keyword_end, expecting ')' '.freeze; end ^ /home/ubuntu/section3/alpha-blog/app/views/users/_form.html.erb:46: syntax error, unexpected keyword_ensure, expecting ')' /home/ubuntu/section3/alpha-blog/app/views/users/_form.html.erb:48: syntax error, unexpected keyword_end, expecting ')'
我的代码如下。 第39行为<% end %>
,第46行&amp; 48 是空的。
<%= render 'shared/errors', obj: @user%>
<div class= 'row'>
<div class = 'col-xs-12'>
<%= form_for(@user, :html => {class: "form-horizontal", role: "form"}) do |f| %>
<div class="form-group">
<div class= "control-label col-sm-2">
<%= f.label :username %>
</div>
<div class="col-sm-8">
<%= f.text_field :username, class: "form-control", placeholder: "enter username", autofocus: true %>
</div>
</div>
<div class= "form-group">
<div class="control-label col-sm-2">
<%= f.label :email %>
</div>
<div class = "col-sm-8">
<%= f.email_field :email, class: "form-control", placeholder: "Enter email" %>
</div>
</div>
<div class = "form-group">
<div class= "control-label col-sm-2">
<%= f.label :password %>
</div>
<div class = "col-sm-8">
<%= f.password_field :password, class: "form-control", placeholder: "Enter password" %>
</div>
</div>
<div class= "form-group" >
<div class = "col-sm-offset-2 col-sm-10">
<%= f.submit(@user.new_record? ? "Sign up": "Update account", class: 'btn btn-primary btn-lg' %>
</div>
</div>
<% end %>
<div class = "col-xs-4 col-xs-offset-4">
[<%= link_to "Cancel request and return to articles listing", articles_path %> ]
</div>
</div>
</div>
答案 0 :(得分:3)
您至少有一个未公开的括号:
更改
f.submit(@user.new_record? ? "Sign up": "Update account", class: 'btn btn-primary btn-lg'
到
f.submit(@user.new_record? ? "Sign up": "Update account", class: 'btn btn-primary btn-lg')