Yes, you're right. This recent commit probably broke the script:

http://gitorious.org/gitorious/mainline/commit/909d42da14d186e4580995f24b56aa4223f7965f

It should be fixed in the repository too.

Cheers, Rodrigo.

Em 21-06-2011 19:41, Mike escreveu:
I was able to work around this by making the following change to
script/create_admin:

From:

user = User.new :password =>  password, :password_confirmation =>
password, :email =>  email, :terms_of_use =>  '1'
user.login = 'admin'
user.is_admin = true

To:

user = User.new :email =>  email, :terms_of_use =>  '1'
user.login = 'admin'
user.is_admin = true
user.password = password
user.password_confirmation = password

Seems to stem from the fact the password and password_confirm are
"protected" ActiveRecord properties.

I'll try to submit a patch once I get a bit more comfortable with
Gitorious and Ruby in general.

Hope this helps...

Regards,
Mike

On Jun 18, 7:40 am, Russell Greenwald
<[email protected]>  wrote:
I'm having issues creating the admin user, I added a "!" to user.save
for debugging.  The error is below.  I'm using strong passwords, but
no luck, any advice?

Error Message

/home/git/gitorious/vendor/rails/activerecord/lib/active_record/
validations.rb:1090:in `save_without_dirty!': Validation failed:
Password can't be blank, Password is too short (minimum is 4
characters), Password doesn't match confirmation
(ActiveRecord::RecordInvalid)

Here is the "create_admin" script

#!/usr/bin/env ruby
require File.dirname(__FILE__)+'/../config/environment'
ActionMailer::Base.raise_delivery_errors = false
ActionMailer::Base.delivery_method = :test

if User.find_by_is_admin(true)
   puts "You already have an Administrator"
   exit!
end

puts "Type in Administrator's e-mail: "
email = gets.strip
puts "Type in Administrator's password: "
password = gets.strip

user = User.new :password =>  password, :password_confirmation =>
password, :email =>  email, :terms_of_use =>  '1'
user.login = 'admin'
user.is_admin = true
if user.save!
   user.activate
   puts "Admin user created successfully."
else
   puts "Failed creating Admin user."
end

--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]

Reply via email to