Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8587255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:31:32+00:00 2026-06-11T22:31:32+00:00

I am working on Michael Hartl’s tutorial (chapter 6). When I try to create

  • 0

I am working on Michael Hartl’s tutorial (chapter 6). When I try to create a new user in the rails console:

user = User.new(name: "Lord of Darkness", email: "LoD@hell.com")

I get:

 => #<User id: nil, name: "Lord of Darkness", email: "LoD@hell.com",
 created_at: nil, updated_at: nil, password_digest: nil>

Which seem to be correct. But when I try to save I get this:

irb(main):007:0> user.save
  ←[1m←[36m (0.0ms)←[0m  ←[1mbegin transaction←[0m
  ←[1m←[35mUser Exists (0.0ms)←[0m  SELECT 1 AS one FROM "users" WHERE LOWER("us
  ers"."email") = LOWER('mhartl@example.com') LIMIT 1
  ←[1m←[36m (0.0ms)←[0m  ←[1mrollback transaction←[0m
  => false

which definitely is not what I want. My user_spec is passing all tests.
My user.rb looks like that:

class User < ActiveRecord::Base
  attr_accessible :email, :name, :password, :password_confirmation
  has_secure_password

  before_save { |user| user.email = email.downcase }

  validates :name,  presence: true, length: { maximum: 50 }
  VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
  validates :email, presence: true, format: { with: VALID_EMAIL_REGEX },
             uniqueness: { case_sensitive: false }
  validates :password, presence: true, length: { minimum: 6 }
  validates :password_confirmation, presence: true
end

What causes this save problem? Without solving this error I cannot go on with the tutorial.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T22:31:33+00:00Added an answer on June 11, 2026 at 10:31 pm

    I believe your error is stemming from the fact that the User you are creating doesn’t have a password.

    Your User model validates a password and requires its presence, but when you create new a User from the command line, he/she doesn’t have a password yet.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on Michael Hartl Rails tutorial (currently chapter 7). When I try
I am working through Michael Hartl's Ruby on Rails Tutorial Chapter 5 exercises and
I'm working through Michael Hartl's Rails Tutorial. I've come to Chapter 9, Exercise 1
I am currently working through Michael Hartl's Rails Tutorial while experimenting with some other
I'm a newbie working through Michael Hartl's Tuby on Rails Tutorial and I have
I am working through the Ruby on Rails Tutorial by Michael Hartl and I
I'am working with Michael Hartl Tutorial. In chapter 7 I've found problem that I
I am working through Michael Hartl's Ruby on Rails tutorial, and I am doing
I'm working through the Rails Tutorial, by Michael Hartl, and a question popped up,
I'm working through Michael Hartl's Ruby on Rails tutorial on http://ruby.railstutorial.org . I'm having

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.