我正在使用 Wicked gem 分多个步骤创建对象。一切似乎都运行良好,直到我意识到数据没有保存。我注意到它没有url: wizard_path
在表单构建器中出现时保存。当那不存在时,数据保存得很好,无论我在哪一步。这是我的对象构建器控制器的样子:
class Bids::BuildController < ApplicationController
include Wicked::Wizard
steps :intro, :problems, :solutions, :pricing
def show
@bid = Bid.find(params[:bid_id])
render_wizard
end
def create
@bid = Bid.new(bid_params)
redirect_to wizard_path(steps.first, :bid_id => @bid.id)
end
def update
@bid = Bid.find(params[:bid_id])
params[:bid][:status] = 'active' if step == steps.last
@bid.attributes = params[:bid].permit(:bid_attribute)
render_wizard @bid
end
# GET /bids/new
def new
@bid = Bid.new
redirect_to wizard_path(steps.first, :bid_id => @bid.id)
end
end