0
我從來沒有使用過MongoDB,並且正在使用其他人的代碼,試圖使用rails_admin gem。當我運行軌道摹rails_admin:安裝時,我得到以下日誌:在MongoDB中使用rails_admin
- Hello, RailsAdmin installer will help you set things up!
- I need to work with Devise, let's look at a few things first:
- Checking for a current installation of devise...
- Found it!
- Looks like you've already installed it, good!
? Where do you want to mount rails_admin? Press <enter> for [admin] >
gsub config/routes.rb
route mount RailsAdmin::Engine => '/admin', :as => 'rails_admin'
- And you already set it up, good! We just need to know about your user model name...
- We found 'user' (should be one of 'user', 'admin', etc.)
? Correct Devise model name if needed. Press <enter> for [user] > admin
- Now setting up devise with user model name 'admin':
generate devise
/Users/sararobinson/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/yaml.rb:56:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
invoke mongoid
create app/models/admin.rb
invoke test_unit
create test/unit/admin_test.rb
create test/fixtures/admins.yml
insert app/models/admin.rb
insert app/models/admin.rb
route devise_for :admins
- Now you'll need an initializer...
create config/initializers/rails_admin.rb
[RailsAdmin] Could not load model App::Models::Mongoid::GridFs, assuming model is non existing. (uninitialized constant App)
[RailsAdmin] Could not load model App::Models::Mongoid::GridFs::Fs::Chunk, assuming model is non existing. (uninitialized constant App)
[RailsAdmin] Could not load model App::Models::Mongoid::GridFs::Fs::File, assuming model is non existing. (uninitialized constant App)
[RailsAdmin] Could not load model Mongoid-gridFs, assuming model is non existing. (wrong constant name Mongoid-gridFs)
- Adding a migration...
- uninitialized constant RailsAdmin::Generators::Utils::ClassMethods::ActiveRecord
- Job's done: migrate, start your server and visit '/admin'!
,然後當我嘗試從控制檯添加管理我得到這個錯誤:
NameError: uninitialized constant Admin
讓我知道如果我應該包含任何其他文件。我對mongo和rails_admin完全陌生,所以任何幫助表示讚賞!
嗨薩拉。你能給我們更多的信息嗎?您使用的是rails,rails_admin和mongoid的哪個版本?隨意轉存您的寶石名單。 –