ruby-on-rails - Neo4j 与 Jruby 项目 rails

标签 ruby-on-rails ruby jruby constants neo4j

我正在尝试在 Mac OSX 上将 neo4j 与 Ruby on rails 结合使用。 我已经用 brew 安装了 jruby 和 neo4j。 我遵循了本指南: http://wiki.neo4j.org/content/Getting_Started_With_Ruby 和这个: https://github.com/andreasronge/neo4j 首先,我的服务器 Neo4j 启动了,我能够创建一个节点和一个关系。

我用 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/jruby-1.6.3@neo4j/gems/railties-3.1.3/lib/rails/commands.rb:49
        require at org/jruby/RubyKernel.java:1038
         (root) at script/rails:6

我在 Google 上搜索过,但没有发现任何人有同样的错误。

这是我的 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

最佳答案

奇怪,你用的rails、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

如何重现此问题?

关于ruby-on-rails - Neo4j 与 Jruby 项目 rails ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8577254/

相关文章:

ruby-on-rails - 我如何使这个 Ruby 方法更像 'ruby-esque' - 即干燥和光滑?

ruby-on-rails - ActiveRecord 和关联排序

ruby-on-rails - 如何在 Rails 中将一个模型的内容分配给另一个模型?

ruby-on-rails - 使用 Devise 在 Rails 应用程序中有条件地注销

java - 将时间/日期时间/数据转换为 java.util.Calendar?

java - 当您在嵌入式 JRuby 中执行 Ruby 脚本时,您可以使用 gems 吗?

ruby-on-rails - 开始在 OS X 10.6 上进行 Rails 3 和 JRails 3 开发

ruby-on-rails - Ruby 进程占用 100% CPU

Ruby:如何即时创建 attr_accessor

ruby-on-rails - 使用 whenever gem 安排顺序任务