2011-12-20 52 views
2

我想在Mac OSX上的rails上使用neo4j與Ruby。 我用brew安裝了jruby和neo4j。 我遵循這個指南: http://wiki.neo4j.org/content/Getting_Started_With_Ruby 這: https://github.com/andreasronge/neo4j 首先,我的服務器Neo4j的開始,我就能夠創建一個節點和關係。Neo4j與Jruby項目導軌

我用RVM創建了一個新的gemset(ree install jruby @ neo4j)。其次,測試的第一個指南是成功的。

所以,我用命令的第二個嚮導創建了一個新項目。 該項目已創建並且該包已成功。 但是當我去啓動服務器(rails s)它給了我:

NameError: uninitialized constant Neo4j::Rails::Application 
    const_missing at org/jruby/RubyModule.java:2590 
      Neo4j at /Users/guillaumelegendre/dev/boosket/neo4j/config/application.rb:19 
     (root) at /Users/guillaumelegendre/dev/boosket/neo4j/config/application.rb:18 
     require at org/jruby/RubyKernel.java:1038 
     (root) at /Users/guillaumelegendre/dev/boosket/neo4j/config/application.rb:52 
      tap at org/jruby/RubyKernel.java:1804 
     (root) at /Users/guillaumelegendre/.rvm/gems/[email protected]/gems/railties-3.1.3/lib/rails/commands.rb:49 
     require at org/jruby/RubyKernel.java:1038 
     (root) at script/rails:6 

我搜索谷歌,但餘did't找到了同樣的錯誤任何人。

這是我的application.rb中,但這是屬於第二腳本的引導application.rb中:

require File.expand_path('../boot', __FILE__) 

require 'action_controller/railtie' 
require 'action_mailer/railtie' 
require 'active_resource/railtie' 
require 'rails/test_unit/railtie' 
require 'will_paginate/railtie' 
require 'neo4j' 


if defined?(Bundler) 
    # If you precompile assets before deploying to production, use this line 
    Bundler.require(*Rails.groups(:assets => %w(development test))) 
    # If you want your assets lazily compiled in production, use this line 
    # Bundler.require(:default, :assets, Rails.env) 
end 

module Neo4j 
    class Application < Rails::Application 
    # Settings in config/environments/* take precedence over those specified here. 
    # Application configuration should go into files in config/initializers 
    # -- all .rb files in that directory are automatically loaded. 

    # Custom directories with classes and modules you want to be autoloadable. 
    # config.autoload_paths += %W(#{config.root}/extras) 

    # Only load the plugins named here, in the order given (default is alphabetical). 
    # :all can be used as a placeholder for all plugins not explicitly named. 
    # config.plugins = [ :exception_notification, :ssl_requirement, :all ] 

    # Activate observers that should always be running. 
    # config.active_record.observers = :cacher, :garbage_collector, :forum_observer 

    # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 
    # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 
    # config.time_zone = 'Central Time (US & Canada)' 

    # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 
    # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 
    # config.i18n.default_locale = :de 

    # Configure the default encoding used in templates for Ruby 1.9. 
    config.encoding = "utf-8" 

    # Configure sensitive parameters which will be filtered from the log file. 
    config.filter_parameters += [:password] 

    # Enable Neo4j generators, e.g: rails generate model Admin --parent User 
    config.generators do |g| 
     g.orm    :neo4j 
     g.test_framework :rspec, :fixture => false 
    end 

    # Configure where the neo4j database should exist 
    config.neo4j.storage_path = "#{config.root}/db/neo4j-#{Rails.env}" 


    # Enable the asset pipeline 
    config.assets.enabled = true 

    # Version of your assets, change this if you want to expire all your assets 
    config.assets.version = '1.0' 
    end 
end 

回答

1

奇怪,是什麼版本的軌道,JRuby和Neo4j的你呢? 它應該工作開箱:

gem install rails 
rails new myapp -m http://andreasronge.github.com/rails3.rb 
cd myapp 
bundle 
rails generate scaffold User name:string email:string 
rails s 
open a webbrowser: http://localhost:3000/users 

我怎樣才能重現此問題?

+0

我使用的JRuby 1.6.3 的Neo4j社區1.5 軌3.1.3 如果我嘗試: 軌生成腳手架用戶名:字符串email:字符串 服務器回答我同樣的錯誤。 我上次安裝時沒有看到任何錯誤。但是,如果你看不到原因,我嘗試重新安裝所有清潔。我會爲你提供結果。 我很感激你的興趣。 – Guillaume 2011-12-20 16:42:33

+0

你不應該安裝neo4j!這是一個嵌入式數據庫,neo4j gem包含了所有內容。你使用哪個版本的寶石?你還應該使用最新的jruby 1.6.5什麼:ruby -v告訴你(只是爲了確保你真的在jruby上) – 2011-12-20 21:03:06

+0

我在jruby 1.6.3上顯然我需要配置rvm使用1.6.5(誰如果我正確地理解紅寶石1.9是違反1.6.3紅寶石1.8.7)。我不知道這是否重要。 – Guillaume 2011-12-21 11:30:24