Skip to content
This repository has been archived by the owner on Jul 7, 2021. It is now read-only.

No route matches {:action=>"show", :controller=>"user_steps", :id=>nil} error when trying to do a form using Wicked #2

Open
Char0394 opened this issue Jul 20, 2014 · 1 comment

Comments

@Char0394
Copy link

Im using Rails 4, I really don't know what more i can do to fix this error :(

User Controller

class UsersController < ApplicationController
def index
end

def show
end

def new
@user = User.new
end

def create
@user = Student.new(user_params)

if @user.save
flash[:success] = 'Welcome to Bilden App!'
sign_in @user
redirect_to user_steps_path(:new, :user_id => @user.id)

else
render :new

end
end

private
def user_params
params.require(:user).permit(:first_name,:last_name, :email, :password, :password_confirmation,:career_code, :extra_credits)
end

end

User steps controller

class UserStepsController < ApplicationController
include Wicked::Wizard
steps :new, :new2

def show
@user = current_user
render_wizard
end

def update
@user = current_user
@user.attributes = user_params
render_wizard @user
end

private

def redirect_to_finish_wizard
redirect_to root_url, notice: "Thank you for signing up."
end

def user_params
params.require(:user).permit(:first_name,:last_name, :email, :password, :password_confirmation,:career_code, :extra_credits)
end
end

View(User steps)

<%= form_for @user, url: wizard_path, method: put do |f| %>

<%= f.submit "Continue" %>
or <%= link_to "skip this step", next_wizard_path %>

<% end %>

@schneems
Copy link
Owner

In the console is this a valid path? helper.user_steps_path(:new, :user_id => User.last.id) ?

It looks like for some reason the id isn't being pulled in. You can also try :id => :new while generating the url

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants