4

I have created a wizard form using Wicked gem and it works great for editing existing records. But I can't figure out how to create a new record using this wizard form.

Quotations from documentationBuilding Partial Objects Step by Step:

"This also means to get to the create action we don't have a product_id yet so we can either create this object in another controller and redirect to the wizard, or we can use a route with a placeholder product_id such as [POST] /products/building/build in order to hit this create action."

I tried to do it the same way as described above, but the problem is, that Campaign.create creates empty object without ID needed for Wicked wizard form.

def create
  @campaign = Campaign.create
  redirect_to wizard_path(steps.first, :campaign_id => @campaign.id)
end

I am using Rails 4.0.4. Thank you for any help!

Petr Šuška
  • 275
  • 3
  • 11

0 Answers0