0
我寫了下面的代碼:的form_tag不工作
<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'} %>
我不知道爲什麼,但由於某種原因它給了我兩個錯誤:
/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 ')'
這是爲什麼?我該如何解決它?
當然,謝謝! – weltschmerz