Setup_database fails for sqlite3

I’m trying out the mental branch and sqlite3 doesn’t appear to be
creating User objects properly resulting in the following backtrace:-

– add_index(“users”, [“login”], {:unique=>true, :name=>“login”})
-> 0.2646s
– initialize_schema_information()
-> 0.5167s
– columns(“schema_info”)
-> 0.0040s
OK
Creating user ‘admin’ with password ‘radiant’…FAILED
./script/…/config/…/vendor/rails/activerecord/lib/active_record/base.rb:955:in
find_one': Couldn't find User with ID=0 (ActiveRecord::RecordNotFound) from ./script/../config/../vendor/rails/activerecord/lib/active_record/base.rb:941:infind_from_ids’
from
./script/…/config/…/vendor/rails/activerecord/lib/active_record/base.rb:382:in
find' from ./script/setup_database:179:increate_admin_user’
from ./script/setup_database:258:in announce' from ./script/setup_database:177:increate_admin_user’
from ./script/setup_database:20:in run' from ./script/setup_database:9:inrun’
from ./script/setup_database:297

I took the ugly but easy way out which creates a new User object and
saves it twice, which is really what create is supposed to be doing. I
don’t know if it is my sqlite3 setup that is the problem here. I’m
using sqlite3-ruby here …

— script/setup_database (revision 155)
+++ script/setup_database (working copy)
@@ -175,8 +175,8 @@

def create_admin_user
announce “Creating user ‘admin’ with password ‘radiant’” do

  •  @admin = User.create :name => 'Administrator', :login =>
    

‘admin’, :password => ‘radiant’, :password_confirmation => ‘radiant’,
:admin => true

  •  @admin = User.find(@admin.id)
    
  •  @admin = User.new :name => 'Administrator', :login => 'admin',
    

:password => ‘radiant’, :password_confirmation => ‘radiant’, :admin =>
true, :developer => true

  •  @admin.save!
     UserActionObserver.current_user = @admin
     @admin.created_by = @admin
     @admin.save

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs