def update
p "====================="
@blog = Blog.find(params[:blog_id])
if @blog
@blog.update_attributes(params[:blog])
@blog.save
redirect_to :action => :index
else
redirect_to :action => :new
end
end
<%= form_for(@blog, {:url => {:action => :update,:blog_id => @blog.id}}) do |f| %>
<h3>blog , world!</h3>
<p>This is a template for a simple marketing or informational website. It includes a large callout called a
jumbotron and three supporting pieces of content. Use it as a starting point to create something more
unique.</p>
<div class="input-group input-group-lg" style="width: 1000px">
<%= f.text_field :title,:class => "form-control", :placeholder => "title" %>
</div>
<%= f.text_area :content,:id => "myEditor", :rows => 40, :cols => 120 %>
<label>分类:</label><%= f.select :blog_type_id, options_from_collection_for_select(@blog_types, "id", "name") %>
<br/>
<%= f.submit "发表日志", :class => 'btn btn-lg btn-primary' %>
<%= f.button "保存草稿", :class => 'btn btn-lg btn-primary' %>
<br/><br/>
<% end %>
对数据进行修改,然后提交到 update,不打印 P,但是可以看到提交的参数,最后渲染 update 页面,迷惑