安装rails_admin,一切都停止工作

时间:2012-07-08 13:04:35

标签: ruby-on-rails rails-admin

所以我想创建一个应用程序,人们可以在这里查看艺术。问题是,只有管理员才能创建,编辑和删除数据。所以我想添加一个管理界面。我选择了rails_admin gem。

我已经按照git文档中的说法安装了所有内容,但是当我安装它时,一切都停止了。我无法生成脚手架,模型或控制器,我无法启动我的服务器。每当我尝试一些东西时,它都会给我这个消息。

/Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/inflector/methods.rb:229:in `block in constantize': uninitialized constant Admin (NameError)
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/inflector/methods.rb:228:in `each'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/inflector/methods.rb:228:in `constantize'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/devise-2.1.2/lib/devise.rb:256:in `get'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/devise-2.1.2/lib/devise/mapping.rb:77:in `to'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/devise-2.1.2/lib/devise/mapping.rb:72:in `modules'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/devise-2.1.2/lib/devise/mapping.rb:89:in `routes'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/devise-2.1.2/lib/devise/mapping.rb:156:in `default_used_route'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/devise-2.1.2/lib/devise/mapping.rb:66:in `initialize'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/devise-2.1.2/lib/devise.rb:290:in `new'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/devise-2.1.2/lib/devise.rb:290:in `add_mapping'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/devise-2.1.2/lib/devise/rails/routes.rb:208:in `block in devise_for'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/devise-2.1.2/lib/devise/rails/routes.rb:207:in `each'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/devise-2.1.2/lib/devise/rails/routes.rb:207:in `devise_for'
from /Users/Max/Desktop/walls/config/routes.rb:18:in `block in <top (required)>'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.3/lib/action_dispatch/routing/route_set.rb:282:in `instance_exec'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.3/lib/action_dispatch/routing/route_set.rb:282:in `eval_block'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.3/lib/action_dispatch/routing/route_set.rb:260:in `draw'
from /Users/Max/Desktop/walls/config/routes.rb:1:in `<top (required)>'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/application/routes_reloader.rb:40:in `each'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/file_update_checker.rb:78:in `call'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/file_update_checker.rb:78:in `execute'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/application/routes_reloader.rb:27:in `updater'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/application/finisher.rb:66:in `block in <module:Finisher>'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `run'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `each'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/application.rb:136:in `initialize!'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/Max/Desktop/walls/config/environment.rb:5:in `<top (required)>'
from /Users/Max/Desktop/walls/config.ru:4:in `block in <main>'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
from /Users/Max/Desktop/walls/config.ru:1:in `new'
from /Users/Max/Desktop/walls/config.ru:1:in `<main>'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/builder.rb:40:in `eval'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/builder.rb:40:in `parse_file'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/server.rb:200:in `app'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/commands/server.rb:46:in `app'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/server.rb:301:in `wrapped_app'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/server.rb:252:in `start'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/commands/server.rb:70:in `start'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/commands.rb:55:in `block in <top (required)>'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/commands.rb:50:in `tap'
from /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

在我安装rails_admin之前,我已经完成了所有数据的设置,所以如果我不得不重新开始,那将非常糟糕。

如果有人需要更多信息,我很乐意给予,但我不知道现在要发布什么。

2 个答案:

答案 0 :(得分:1)

看看你的routes.rb,我必须有一些像这样的代码 devise_for:admin_users,ActiveAdmin :: Devise.config

将其删除或删除。您已经删除了管理员,但可能没有在路由中修改。

答案 1 :(得分:0)

要再次返回工作项目状态,请从Gemfile中删除gem'track_admin'声明,从config / initializers目录中删除rails_admin.rb文件,然后从config / routes.rb中删除rails_admin生成的路由:

devise_for :admins
mount RailsAdmin::Engine => '/rails_admin', :as => 'rails_admin'

这就是导致Devise寻找Admin模型的原因。 删除它,以及删除gem和初始化程序文件应该从项目中删除整个内容。