1
votes

I am trying to create an application with JRuby, Rails and Neo4j. I tried installing neo4j and get it started with Rails 5.0.0, but I got several complaint regarding a missing (???) activesupport gem. Which is weird because the gem is listed when I run “gem list”. Well, I tried doing the same using Rails 4.2.6. After many temporary tweaks to eliminate some issues reported below, I finally got neo4j to start. However, I could not start the Rails server unless I commented out almost every line in confit/initializers/new_framework_defaults.rb. Here are the reported errors, and how I dealt with them. Is there a better solution for this, that will not imply enabling/disabling all this configuration methods?

Could please anyone suggest methods to go around/solve all these issues?

  1. gem install rails -v 4.2

  2. bundle exec rails new myApp -m http://neo4jrb.io/neo4j/neo4j.rb -O

  3. cd myApp && bundle exec rake neo4j:install[community-latest]

    • I had to disable "require "action_cable/engine"" in config/application.rb
  4. START NEO4j: bundle exec rake neo4j:start

    PROBLEM 1: NameError: uninitialized constant ActiveSupport::EventedFileUpdateChecker

    • I disabled the line config.file_watcher = ActiveSupport::EventedFileUpdateChecker
      in config/environments/development.rb. Then re-ran bundle exec rake neo4j:start.

    PROBLEM 2: NoMethodError: undefined method `to_time_preserves_timezone=' for ActiveSupport:Module.

    • I commented out the line ActiveSupport.to_time_preserves_timezone = true
      in config/initializers/new_framework_defaults.rb:15. Then re-ran bundle exec rake neo4j:start.

    PROBLEM 3: NoMethodError: undefined method 'halt_callback_chains_on_return_false=' for ActiveSupport:Module

    • I commented out the line ActiveSupport.halt_callback_chains_on_return_false = false
      in config/initializers/new_framework_defaults.rb. Then re-ran bundle exec rake neo4j:start.

    PROBLEM 4: NoMethodError: undefined method `perform_caching=' for ActionMailer::Base:Class

    • I then commented out the line config.action_mailer.perform_caching
      in config/application.rb: require "action_mailer/railtie"
    • I also commented out the following lines in config/environments/development config.action_mailer.raise_delivery_errors = false
      config.action_mailer.perform_caching = false

Then re-ran bundle exec rake neo4j:start:

FINALLY, IT WORKED

5) Starting be rails s

PROBLEM: "Rack app error: #< RuntimeError: Invalid option key: per_form_csrf_tokens=>"

I set Rails.application.config.action_controller.per_form_csrf_tokens = false
in config/initializers/new_framework_defaults.rb. However, it did not help. Below is the full error message:

I had to comment out the line Rails.application.config.action_controller.forgery_protection_origin_check = true in config/initializers/new_framework_defaults.rb

  • Version 3.4.0 (jruby 9.0.4.0 - ruby 2.2.2), codename: Owl Bowl Brawl
  • Min threads: 5, max threads: 5
  • Environment: development
  • Listening on tcp://localhost:3000 Use Ctrl-C to stop 2016-07-05 17:24:39 -0600: Rack app error: # /Users/yandj/.gem/jruby/2.2.2/gems/actionpack-4.2.6/lib/action_controller/railtie.rb:59:in block in Railtie' org/jruby/RubyHash.java:1343:ineach' /Users/yandj/.gem/jruby/2.2.2/gems/actionpack-4.2.6/lib/action_controller/railtie.rb:54:in block in Railtie' org/jruby/RubyBasicObject.java:1633:ininstance_eval' /Users/yandj/.gem/jruby/2.2.2/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:38:in execute_hook' /Users/yandj/.gem/jruby/2.2.2/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:45:inblock in run_load_hooks' org/jruby/RubyArray.java:1560:in each' /Users/yandj/.gem/jruby/2.2.2/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:44:inrun_load_hooks' /Users/yandj/.gem/jruby/2.2.2/gems/actionpack-4.2.6/lib/action_controller/base.rb:266:in <class:Base>' /Users/yandj/.gem/jruby/2.2.2/gems/actionpack-4.2.6/lib/action_controller/base.rb:164:in' /Users/yandj/.gem/jruby/2.2.2/gems/actionpack-4.2.6/lib/action_controller/base.rb:5:in <top>' /Users/yandj/.gem/jruby/2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/middleware/static.rb:1:in(root)' /Users/yandj/.gem/jruby/2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/middleware/static.rb:69:in ext' /Users/yandj/.gem/jruby/2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/middleware/static.rb:27:inmatch?' /Users/yandj/.gem/jruby/2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/middleware/static.rb:114:in call' /Users/yandj/.gem/jruby/2.2.2/gems/rack-1.6.4/lib/rack/sendfile.rb:113:incall' /Users/yandj/.gem/jruby/2.2.2/gems/railties-4.2.6/lib/rails/engine.rb:518:in call' /Users/yandj/.gem/jruby/2.2.2/gems/railties-4.2.6/lib/rails/application.rb:165:incall' /Users/yandj/.gem/jruby/2.2.2/gems/rack-1.6.4/lib/rack/content_length.rb:15:in call' /Users/yandj/.gem/jruby/2.2.2/gems/puma-3.4.0-java/lib/puma/configuration.rb:224:incall' /Users/yandj/.gem/jruby/2.2.2/gems/puma-3.4.0-java/lib/puma/server.rb:569:in handle_request' /Users/yandj/.gem/jruby/2.2.2/gems/puma-3.4.0-java/lib/puma/server.rb:406:inblock in process_client' org/jruby/RubyProc.java:318:in `call'
1

1 Answers

0
votes

Sorry, I think we should have a note in our README about this. Could you try the rails5 branch?

gem 'neo4j', github: 'neo4jrb/neo4j', branch: 'rails5'