简体   繁体   中英

form_for Update Model

I have the following code which I would like to update the particular object in the database. For some reason however this function will not display. Based on the log reports I am getting back nothing is wrong. Information outside of the code block is returned fine.

<% form_for (@person), :url => {:controller => "persons", :action => "update" } do |f| %>
        <%= f.label :name, "Name" %><br/>
        <%= f.text_field :name %>
        <%= f.label :score, "Score" %>
        <%= f.text_field :score %>
  <%= f.submit("Update") %>
<% end %>

你应该使用<%= form_for ...而不是<% form_for ... (它都在等号中)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM