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

  • Home
  • SEARCH
  • 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 6738563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:23:01+00:00 2026-05-26T11:23:01+00:00

I have a seeds.rb file and for some reason, this doesn’t work: #doesn’t work

  • 0

I have a seeds.rb file and for some reason, this doesn’t work:

#doesn't work
u=User.new
u['email']=h['email']
u['password']=h['password']
puts u['email']
puts u['password']
if u.save
  puts "that saved"
else
  puts "that did not save"
end

but this does:

#does work
User.create({:email => h['email'], :password => h['password']})

Is there any reason one works and one doesn’t? From rails console, the first does work? Would there be any differences in validations? I run ‘rake db:seed’ so would think validations would be in effect in both.

thx

edit #1
sorry for lack of info. each one errors with “password can’t be blank” but it then echoes out the password. Hmm…

  • 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-05-26T11:23:02+00:00Added an answer on May 26, 2026 at 11:23 am

    Find out what’s happening by looking at the validation errors:

    else
      puts "that did not save because " + u.errors.join(' ')
    end
    

    Edit: Now that you’ve added that validation errors contain 'password cant be blank' and it still fails to save, it becomes clear that User.create() does a number of things which User.save() omits.

    What’s missing is the generation of your password hash – hence the blank password error.

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

Sidebar

Related Questions

Having a noob day. For some reason this works: // check for user in
Why does Java not have a file copy method? This seems like such an
I have the following code pasted below. For some reason, the response.redirect seems to
For some reason, the files in the database won't open if they have the
I'm using this library to hook keys and I have some problems with comparing
I have to parse a tab-delimited text file with Ruby to extract some data
I have to develop an application which parses a log file and sends specific
On a SQL Server 2000 system, I have a templog.ldf file that seems to
I have the following file (above) which seems to be an Unix pipe alt
I have just one cs file in my repository which Git seems to think

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.