我在向导中有一个嵌套表单。我如何执行更新操作,以便同时更新两个表。我的表格是:
<%= form_for(@web, url: wizard_path, :method => :put, html: {:class=>"form-horizontal, left"}) do |f| %>
<%= fields_for resource.role do |rf| %>
<%= rf.text_field :fname, :class=>"span5", type: "text", placeholder: "First Name", required: "" %>
</div>
</div>
<%= rf.text_field :lname, :class=>"span5", type: "text", placeholder: "Last Name", required: "" %>
<% end %>
<% end %>
我有resource.role =“用户”。
我的模型是网络和用户。
我试过这样做,但只有 web 表得到更新:
class UserStepsController < ApplicationController
include Wicked::Wizard
steps :personal, :organization
def show
@web = current_web
render_wizard
end
def update
@web = current_web
@web.attributes = params[:web]
render_wizard @web
end
end
请帮忙