我正在使用ActiveAdmin框架,我跟着ActiveAdmin的入門,並在最後一步rails generate active_admin:resource [MyModelName]
我寫這個:rails generate active_admin:resource User
然後我試着在瀏覽器中看到結果,所以我運行服務器rails s
,然後我得到這個問題:運行軌服務器命令
[email protected]:~/Desktop/rails_proyects/fulbo$ rails server
=> Booting WEBrick
=> Rails 3.2.13 application starting in development on `http://0.0.0.0:3000`
=> Call with -d to detach
=> Ctrl-C to shutdown server Exiting /home/edu/Desktop/rails_proyects/fulbo/app/admin/users.rb:1:in `<top
(required)>': uninitialized constant User (NameError) from
/home/edu/.rvm/gems/[email protected]/gems/activeadmin-0.6.0/lib/active_admin/application.rb:179:in
`block in load!' from
/home/edu/.rvm/gems/[email protected]/gems/activeadmin-0.6.0/lib/active_admin/application.rb:179:in
`each' from
/home/edu/.rvm/gems/[email protected]/gems/activeadmin-0.6.0/lib/active_admin/application.rb:179:in
`load!' from
/home/edu/.rvm/gems/[email protected]/gems/activeadmin-0.6.0/lib/active_admin/application.rb:197:in
`routes' from
/home/edu/.rvm/gems/[email protected]/gems/activeadmin-0.6.0/lib/active_admin.rb:83:in
`routes' from
/home/edu/Desktop/rails_proyects/fulbo/config/routes.rb:3:in `block in
<top (required)>' from
/home/edu/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:289:in
`instance_exec' from
/home/edu/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:289:in
`eval_block' from
/home/edu/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:267:in
`draw' from
/home/edu/Desktop/rails_proyects/fulbo/config/routes.rb:1:in `<top
(required)>' from
/home/edu/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:40:in
`block in load_paths' from
/home/edu/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:40:in
`each' from
/home/edu/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:40:in
`load_paths' from
/home/edu/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:16:in
`reload!' from
/home/edu/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/application.rb:108:in `reload_routes!' from
/home/edu/.rvm/gems/[email protected]/gems/activeadmin-0.6.0/lib/active_admin/reloader.rb:34:in
`reload!' from
/home/edu/.rvm/gems/[email protected]/gems/activeadmin-0.6.0/lib/active_admin/reloader.rb:61:in
`block in attach!' from
/home/edu/.rvm/gems/[email protected]/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:429:in
`_run__246534365__prepare__874865436__callbacks' from
/home/edu/.rvm/gems/[email protected]/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in
`__run_callback' from
/home/edu/.rvm/gems/[email protected]/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in
`_run_prepare_callbacks' from
/home/edu/.rvm/gems/[email protected]/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in
`run_callbacks' from
/home/edu/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/action_dispatch/middleware/reloader.rb:74:in
`prepare!' from
/home/edu/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/action_dispatch/middleware/reloader.rb:48:in
`prepare!' from
/home/edu/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/application/finisher.rb:47:in
`block in <module:Finisher>' from
/home/edu/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec' from
/home/edu/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run' from
/home/edu/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers' from
/home/edu/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each' from
/home/edu/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers' from
/home/edu/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!' from
/home/edu/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in
`method_missing' from
/home/edu/Desktop/rails_proyects/fulbo/config/environment.rb:5:in
`<top (required)>' from
/home/edu/Desktop/rails_proyects/fulbo/config.ru:3:in `block in
<main>' from
/home/edu/.rvm/gems/[email protected]/gems/rack-1.4.5/lib/rack/builder.rb:51:in
`instance_eval' from
/home/edu/.rvm/gems/[email protected]/gems/rack-1.4.5/lib/rack/builder.rb:51:in
`initialize' from /home/edu/Desktop/rails_proyects/fulbo/config.ru:in
`new' from /home/edu/Desktop/rails_proyects/fulbo/config.ru:in
`<main>' from
/home/edu/.rvm/gems/[email protected]/gems/rack-1.4.5/lib/rack/builder.rb:40:in
`eval' from
/home/edu/.rvm/gems/[email protected]/gems/rack-1.4.5/lib/rack/builder.rb:40:in
`parse_file' from
/home/edu/.rvm/gems/[email protected]/gems/rack-1.4.5/lib/rack/server.rb:200:in
`app' from
/home/edu/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/commands/server.rb:46:in `app' from
/home/edu/.rvm/gems/[email protected]/gems/rack-1.4.5/lib/rack/server.rb:304:in
`wrapped_app' from
/home/edu/.rvm/gems/[email protected]/gems/rack-1.4.5/lib/rack/server.rb:254:in
`start' from
/home/edu/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/commands/server.rb:70:in `start' from
/home/edu/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/commands.rb:55:in
`block in <top (required)>' from
/home/edu/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/commands.rb:50:in
`tap' from
/home/edu/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/commands.rb:50:in
`<top (required)>' from script/rails:6:in `require' from
script/rails:6:in `<main>'
有人知道如何解決它或什麼是錯的。
你確定,你做了捆綁exec rake db:migrate'嗎? – kiddorails 2013-04-25 23:16:58
我這樣做,我得到這個:耙子中止!未初始化的常量用戶 – edudepetris 2013-04-25 23:47:43
您試圖正確運行服務器的IP /端口? – jmstone617 2013-04-26 02:27:13