I'am struggling with adding a parameter to redirect_to using wicked I followed the Railscast and read the information on the github page but can't get it to work. I want to create a object plugin and after it is saved there should be the possibility to add stuff to it.
Here is what i got:
plugins_controller:
def create
@plugin = Plugin.new(params[:plugin])
if @plugin.save
redirect_to plugins_steps_path, :plugin_id => @plugin.id
end
end
plugins_steps controller:
def show
@plugin = Plugin.find(params[:plugin_id])
render_wizard
end
routes:
resources :plugins_steps
I never get any parameter to the show method in plugins_steps is there a way to solve this? I also tried several redirect_to methods like:
redirect_to :controller: "plugins_steps", :action => "show", :plugin_id => @plugin.id
or
redirect_to({:plugin_id => @plugin.id })
Thank you very much.
plugins_steps_path
is the path for the index action. If you want the show action, use plugin_step_path
(ie step must be singular). Run rake routes
to verify this. Also, instead of calling the param :plugin_id
, just use :id
and update your show controller accordingly.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.