Question: Syntax error on empty line

Question

Syntax error on empty line

Answers 1
Added at 2017-01-03 15:01
Tags
Question

I have the following error showing, not sure what went wrong...

/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 ')'

My codes are below. Line39 is <% end %> and line 46 & 48 are empty.

<%= 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>
Answers to

Syntax error on empty line

nr: #1 dodano: 2017-01-03 15:01

You have at least one unclosed bracket:

Change

f.submit(@user.new_record? ? "Sign up": "Update account", class: 'btn btn-primary btn-lg'

to

f.submit(@user.new_record? ? "Sign up": "Update account", class: 'btn btn-primary btn-lg')
Source Show
◀ Wstecz