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