I am using the wicked gem to build a form wizard. In the documentation, it is using the current_user object but I want to use a different object. I am struggling with adding a parameter to redirect_to so I can use this object.
products_controller.rb
def create
@product = current_user.product.build(params[:product])
@product.ip_address = request.remote_ip
if @product.save
redirect_to product_steps_path # This is where I think I need to pass product object but not sure how
else
render 'new'
end
end
product_steps_controller.rb
class ProductStepsController < ApplicationController
include Wicked::Wizard
steps :apps, :templates
def show
@product = Product.find(params[:id])
render_wizard
end
end
routes:
resources :products
resources :product_steps
The error I get with the above code is:
ActiveRecord::RecordNotFound in ProductStepsController#show
Couldn't find Product with id=apps
How do I use the wicked gem on a specific object like this instead of the current_user example in the documentation?