vendredi 11 mars 2016

Syntax Error in Ruby on Rails for html

I am currently learning Ruby on Rails and I am curious why this is not working, I have a page called new.html.erb, but in views I placed the following code <%= form_for :article, url: articles_path do |f| %> in app/views/articles/new.html.erb. However, I keep receiving the message:

app/views/articles/new.html.erb:3: syntax error, unexpected keyword_ensure, expecting keyword_end

app/views/articles/new.html.erb:5: syntax error, unexpected end-of-input, expecting keyword_end

new.html.erb

<%= form_for :article do |f| %>
  <p>
    <%= f.label :title %><br>
    <%= f.text_field :title %>
  </p>

  <p>
    <%= f.label :text %><br>
    <%= f.text_area :text %>
  </p>

  <p>
    <%= f.submit %>
  </p>
<% end %>

Thanks in advance for any help!

1 commentaire: