-4

创建产品并使用 wicked gem 更新对象后,日志正在吐出

在重定向到参数变为空的步骤上。有人知道为什么吗?

[object Object]

HTTP_REFERER    http://localhost:3000/products/new?
params  null
utf8    ✓


def create
    @product = current_user.products.build(params[:product])
    if @product.save

      redirect_to product_step_path(@product, Product.form_steps.first, only_path: true, format: :html)

    else
      render :new, format: :html
    end
  end

class Product::StepsController < ApplicationController
  include Wicked::Wizard
  steps *Product.form_steps

  def show
    @product = Product.find(params[:product_id])

    render_wizard 
   end
end
4

1 回答 1

0

在重定向到参数变为空的步骤上。有人知道为什么吗?

是的。因为你告诉它这样做。

  redirect_to product_step_path(@product, Product.form_steps.first, only_path: true, format: :html)

您将进入带有新参数的新页面。如果您希望当前请求的某些参数在此下一个请求中可用,请在redirect_to.

于 2017-03-10T11:18:24.950 回答