0
我用_form.html.erb編輯遊戲時遇到問題。我的代碼如下:與刪除結合時更新記錄錯誤
<%= form_for @game, :html => { :multipart => true } do |f| %>
<% if @game.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@game.errors.count, "error") %> prohibited this game from being saved:</h2>
<ul>
<% @game.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<div id="p1"><%= f.label :game_name %> </div>
<%= f.text_field :game_name %>
</div>
<br />
<div class="field">
<div id="p1"><%= f.label :genre %> </div>
<%= f.text_field :genre %>
</div>
<br />
<div class="field">
<div id="p1"><%= f.label :console %> </div>
<%= f.select :console, Game::CONSOLE_OPTIONS, :prompt => 'Select' %>
</div>
<br />
<div class="field">
<div id="p1"><%= f.label :condition %> </div>
<%= f.text_field :condition %>
</div>
<br />
<div class="field">
<div id="p1"><%= f.label :description %> </div>
<%= f.text_area :description, :rows => 6 %>
</div>
<%= f.file_field :photo %>
<br />
<div class="actions">
<%= f.submit %>
<%= button_to 'Destroy', root_url, :confirm => 'Are You Sure?', :method => :delete %>
</div>
<% end %>
我遇到的問題如下。如果我點擊刪除按鈕,它將刪除記錄沒有問題,但如果我點擊更新按鈕,它也會刪除記錄。如果我拿出刪除命令,那麼它更新正常。我怎樣才能在履行個人職責的同時一起展示?
製作提交給不同操作的不同表單。 – clyfe 2012-02-23 14:33:39
乾杯clyfe全部排序:) – user1222136 2012-02-23 14:43:47