Signup II step 2 with error wrong number of arguments (0 for 1)


#1

Hi so I ran into more errors with this code:

class UsersController < ApplicationController
def new
@user = User.new
end
def user_params
params.require(:user).permit(:first_name, :last_name, :email, :password)
 end
 def create private 
@user = User.new(user_params) 
if @user.save 
session[:user_id] = @user.id 
redirect_to '/' 
 else 
	redirect_to '/signup' 
    end
  end   
end

I don't know what I'm doing wrong. I typed it in like it told me to do and now it won't let me go forward. Can someone help?

Thanks,
~Fiona~


#2

Never mind I figured it out. After a look or two, I found where I messed up.

Here's my code after I fixed it:

class UsersController < ApplicationController
def new
   @user = User.new
end
def user_params
params.require(:user).permit(:first_name, :last_name, :email, :password)
 end
 def create 
   @user = User.new(user_params) 
    if @user.save 
      session[:user_id] = @user.id 
      redirect_to '/' 
    else 
     redirect_to '/signup' 
    end 
  end
end

So I guess you really don't need private.


#4

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.