ryanb/railscasts-episodes

Episode #346 - No route matches {:action=>"show", :controller=>"user_steps", :id=>nil}

Char0394 opened this issue · 0 comments

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 %>