I’m trying to create a new website with RoR and I’m using RadRails. I’m
on a Windows XP machine with the latest installs of all the programs. I
created the project and migration file with RadRails and not by hand. I
have filled in the 001_sse.rb file properly but get an error at a line
in teh migration file that creates the default user.
User.create(‘admin’, User.hash_password(‘admin’), ‘Administrator’,
‘Admin’)
I get the following error:
G:\Workspace\sse>rake migrate --trace
(in G:/Workspace/sse)
** Invoke migrate (first_time)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
== Sse: migrating
– create_table(“documents”, {:force=>true})
-> 0.0470s
…# Creating tables
– add_index(“events”, [“user_id”], {:name=>“FK_user_id”})
-> 0.1410s
rake aborted!
uninitialized constant User
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependenci
es.rb:123:in const_missing' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependenci es.rb:131:in
const_missing’
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependenci
es.rb:133:in const_missing' ./db/migrate//001_sse.rb:92:in
real_up’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.r
b:210:in migrate' c:/ruby/lib/ruby/1.8/benchmark.rb:293:in
measure’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.r
b:210:in migrate' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.r b:333:in
migrate’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.r
b:328:in migrate' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.r b:295:in
up’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.r
b:286:in migrate' c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/tasks/databases.rake:4 c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in
execute’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in execute' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:357:in
invoke’
c:/ruby/lib/ruby/1.8/thread.rb:135:in synchronize' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in
invoke’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:364:in
invoke_prerequisit es' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:999:in
each’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:363:in
invoke_prerequisit es' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:356:in
invoke’
c:/ruby/lib/ruby/1.8/thread.rb:135:in synchronize' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in
invoke’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in run' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in
run’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/bin/rake:7
c:/ruby/bin/rake.bat:25
If I run the webrick server I get this when I look at the list view:
NameError in UsersController#list
uninitialized constant User
RAILS_ROOT: ./script/…/config/…
Application Trace | Framework Trace | Full Trace
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:123:in
const_missing' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:in
const_missing’
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/inflector.rb:161:in
constantize' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/core_ext/string/inflections.rb:59:in
constantize’
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/pagination.rb:194:in
paginator_and_collection_for' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/pagination.rb:129:in
paginate’
#{RAILS_ROOT}/app/controllers/users_controller.rb:12:in list' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:941:in
perform_action_without_filters’
…
Does anyone know if I can get around this problem?