Wicked gem Rails - 如何创建一个新对象

Blu*_*ird 6 controller ruby-on-rails

大厦局部对象,分步页面上的妖兽宝石百科解释了如何创建一个脚印与对象的步骤wicked

但是我必须如何创建一个新Product对象?

我必须在 的新动作中这样做ProductsController吗?我必须重定向到哪里?

Sas*_*asi 5

逐步构建部分对象页面中给出了以下语句。

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.

您可以在另一个控制器中创建对象并重定向到向导或使用带有占位符的路由来执行创建操作。