I have written the following code:
<h1>Add new book</h1>
<%= form_tag :action => 'create' do %>
<p><label for="book_title">Title</label>:
<%= text_field 'book', 'title' %></p>
<p><label for="book_price">Price</label>:
<%= text_field 'book', 'price' %></p>
<p><label for="book_subject">Subject</label>:
<%= collection_select(:book, :subject_id, @subjects, :id, :name) %></p>
<p><label for="book_description">Description</label><br/>
<%= text_area 'book', 'description' %></p>
<%= submit_tag "Create" %>
<%= end %>
<%= link_to 'Back', {:action => 'list'} %>
I don’t know why, but for some reason it gives me two errors:
/Developer/Rubyonrails/library/app/views/book/new.html.erb:14: syntax error, unexpected keyword_ensure, expecting ')'
/Developer/Rubyonrails/library/app/views/book/new.html.erb:16: syntax error, unexpected keyword_end, expecting ')'
Why is that? How can I fix it?
The
endshould not be inside a string emitter, but embedded Ruby code: