5 Signup II


#1

These are the directions for #1. I can't get anywhere..... I need HELP
1.
Next, let's take in data submitted through the signup form and save it to the database.

In the Users controller, add a private method user_params

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


#2

Now I can't get past #2 ! Directions are
Between the new action and the private method, add the create action

def create
@user = User.new(user_params)
if @user.save
session[:user_id] = @user.id
redirect_to '/'
else
redirect_to '/signup'
end
end

I got past #1 with this......,..
class UsersController < ApplicationController
private
def user_params
params.require(:user).permit(:first_name, :last_name, :email, :password)
end
def new
@user = User.new
end
end


#3

I am also having trouble with step 1. I enter the code as shown in the lesson...

class UsersController < ApplicationController
  def create 

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

And it gives me the error:
Oops! The test returned an error. Maybe you have a syntax error, or a typo.
Hide error.
/var/lib/gems/2.0.0/gems/activerecord-4.1.1/lib/active_record/migration.rb:389:in `check_pending!': (ActiveRecord::PendingMigrationError)
So I'm super confused, and stuck on this step. Help! :slightly_smiling:


#4

Here is my code, and it works.


private
def user_params

params.require(:user).permit(:first_name, :last_name, :email, :password)
end