2013-05-30 40 views
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完全陌生,所以任何幫助表示讚賞!

+0

嗨薩拉。你能給我們更多的信息嗎?您使用的是rails,rails_admin和mongoid的哪個版本?隨意轉存您的寶石名單。 –

回答

1

的錯誤似乎是在這裏:

[RailsAdmin] Could not load model App::Models::Mongoid::GridFs, assuming model is non existing. (uninitialized constant App) 

請參見以下問題:https://github.com/sferik/rails_admin/issues/1808

爲了解決這個問題,從GitHub使用最新的主寶石。你可以這樣做更換gem 'rails_admin'在你的Gemfile爲:

gem 'rails_admin', :git => "https://github.com/sferik/rails_admin.git" 

一旦修復被釋放,你就可以移動到官方寶石寶石,但現在你需要這與使用它Mongoid。