I want to try using neo4j with Rails 3.2 app which is using Ruby MRI.
In this setup doc, bundling the app requires ActiveSupport 4, so, the question is whether it's possible to use the current setup (ActiveSupport 3.2.x) without using JRuby.
The preferred setup is to use server db, not embedded.
Thanks
That is a good question. I took a look through the git logs and I can't tell when it was switched from version 3 to version 4. It looks like it has been using 4 since version 3.0.0 of the neo4j gem, though, which is when we started supporting server mode.
With regards to JRuby, even if it was an option for you, you would still need to use ActiveSupport so I don't think it would help.
I tried changing activesupport, activemodel, and railties to version 3 in the gem and running the specs and came up with this:
/Users/brian/github/neo4jrb/neo4j/lib/neo4j/active_node/scope.rb:1:in `require': cannot load such file -- active_support/per_thread_registry (LoadError)
from /Users/brian/github/neo4jrb/neo4j/lib/neo4j/active_node/scope.rb:1:in `<top (required)>'
from /Users/brian/github/neo4jrb/neo4j/lib/neo4j.rb:89:in `require'
So it looks like there's at least one thing in ActiveSupport 4 that we depend on.
If this is really important, I would suggest forking the neo4j repository and including it in your Gemfile like this:
gem 'neo4j', github: 'your_username/neo4j'
Then in your repository you can change the neo4j.gemspec to use version 3 of the gems that I listed above. Then you'd need to fix the issue I mentioned above and any others that you might run across. Obviously this would make it difficult to keep up with the latest changes to the gem.
Generally I'm in favor of supporting older versions of Rails / ActiveSupport as much as we can. It looks like the upgrade to ActiveSupport 4 preceded me, but we'll definitely thinking thrice before depending on any features in 5.
Good luck!
Related
I'm following Michael Hartl's Ruby on Rails tutorial book and am trying to install rails. As the book says, I followed the instructions on InstallRails.com and got through most of it until I was told to run rails server and I kept getting the error that I didn't have railties gem not installed. I had initially ran sudo gem install rails and so I read that it didn't pick up railties for some reason but gem install rails did - so that fixed it. So now I was able to run rails server and the app was live.
I returned to the book and as the instructions say, I generated a new rails app, specifying the rails version (4.2.2). However, when I run rails again, I get errors. At this point, having tried a dozen different stackover flow solutions, I feel like I must have screwed up the files and maybe I should just get rid of rails completely and try installing from scratch.
Here's some information on where I'm currently at:
Faiques-MacBook-Pro:Desktop Faique$ rails -v
Rails 4.2.3
Faiques-MacBook-Pro:Desktop Faique$ ruby -v
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
Faiques-MacBook-Pro:Desktop Faique$ mkdir workspace
Faiques-MacBook-Pro:Desktop Faique$ cd workspace
Faiques-MacBook-Pro:workspace Faique$ rails _4.2.2_ new hello_app/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': Could not find 'railties' (= 4.2.2) - did find: [railties-4.2.3] (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/ ubygems/dependency.rb:307:in `to_spec'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
from /usr/bin/rails:22:in `<main>'
I'm not sure what other information I should provide.
This isn't an ideal solution but what I ended up doing was completely restoring my mac and then reinstalling rails but using rbenv instead as per a friend's recommendation. I am now set up with Rails.
I wanted to do a complete restore (deleting all my data) because I had tried so many stack overflow answers for different errors - including using sudo for certain commands - that I'm sure I had messed some important settings and would take a long time to figure out. I think this was surprisingly one of the more efficient solution, although far from ideal.
Stupid question:
I'm using Railties version 3.2.3 and wish to check which version of Rails its running exactly (what with the recent number of security issues). I've looked into the gem's code but can't seem to get a handle on it. Perhaps I'm being stupid and the rails version matches that of realties?
Either way I'd appreciate help on this.
Rails::VERSION::STRING returns the currently running version of Rails when used within your app.
I just installed the newrelic_rpm gem in my RefineryCMS Rails 3.2.3 application. I copied in the newrelic.yml config file as per the instructions. My app is being deployed with Heroku on the Cedar stack, so the instructions were pretty simple.
https://devcenter.heroku.com/articles/newrelic#cedar
However, running "rails server" on my development box gave me this error message:
/home/xxx/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:398:in `retrieve_connection': ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished)
Setting the agent_enabled value to "false" in the newrelic.yml file allowed the server to start up again. Setting my license key and app name environment variables made no difference.
Interestingly, even though I couldn't get the app to start on my dev box, when I deployed it to Heroku, everything worked fine - and I am now getting new relic stats. Great!
My workaround has been to remove newrelic_rpm from the gemfile (which is what the install instructions say to do), and put it only into a :production group. Obviously, new relic is only useful in production, so it's no big deal.
group :production do
... other gems
gem 'newrelic_rpm'
end
Anyone else ever experienced this, or know why it should be causing an ActiveRecord error (with no mention in the error trace of new relic at all)?
The issue you were running into looks like a bug in the newrelic_rpm gem that was addressed with our (I work at New Relic) recent 3.6.4 release. I'd suggest that you try updating to 3.6.4 to see if the issue persists.
By way of explanation: we have something in the newrelic_rpm gem called an EnvironmentReport, which gathers information about the environment your application is executing in (Rails version, gem versions, DB adapter, Ruby version, etc) to display in the UI. In version 3.6.0 of the newrelic_rpm gem, we pushed the generation of the EnvironmentReport into a background thread. Because the EnvironmentReport potentially referenced the ActiveRecord::Base constant, generating it could trigger some ActiveRecord initialization code paths that are not thread-safe. If the EnvironmentReport happened to hit ActiveRecord::Base at just the wrong time, it could trigger errors like what you were seeing on the main thread.
We addressed this in 3.6.4 by moving the generation of the EnvironmentReport back onto the main thread.
Sorry for the headache, and please let us know if 3.6.4 doesn't solve your issue.
Edit - hmm, just noticed that you asked about this before 3.6.0 was released. I'd still suggest trying 3.6.4, since I suspect a similar race condition may have existed in older versions of the newrelic_rpm.
I wanted to use this gem:
https://github.com/PRX/apn_on_rails
Finally, after digging through the issues, seems it's not Rails3 ready (yet). Is there some simple way of finding is something is Rails 3 compatible without digging all over?
Thanks!
Aside from creating a fresh Rails app and giving it a try, I tend to look at the commit messages of forks created by other users (i.e. https://github.com/PRX/apn_on_rails/network). In this instance, it looks like there is a fork that runs on Rails 3 that is still being maintained.
Generally, if it isn't mentioned in the readme (on github) then no. Most gems I have used explicitly specify rails 2 and rails 3 install instructions. If this is not the case, then usually someone else will have asked this question and a quick search will reveal.
One other giveaway is the install instructions. The rails 2 way of installing a gem via a Gemfile is:
config.gem GEMNAME
The rails 3 way is:
gem 'apn_on_rails'
This answer is related to the gem you are looking for.
Having problems getting glassfish to even run on my server. jRuby is absoutely maddening to begin with, but this is killing me.
I have a pretty complex app, so I won't go into too many details, other than to say the Rails2 version is working under jRuby 1.5.1.
When I start and do the first hit on the server I get the following error:
Feb 19, 2011 12:20:14 AM com.sun.grizzly.jruby.RackGrizzlyAdapter dispatchRequest
WARNING: (NoMethodError) undefined method `call' for nil:NilClass
org.jruby.exceptions.RaiseException: (NoMethodError) undefined method `call' for nil:NilClass
at Rack::Handler::Grizzly.call(/usr/local/rvm/gems/jruby-1.6.0.RC2/gems/glassfish-1.0.3.dev-universal-java/lib/rack/handler/grizzly.rb:55)
I have tried starting glassfish every way since sunday and have also swapped out various gems. It seems bundler 1.0.10 also has some issues. It broke my Rails2 app.
Any insite anywhere as to where to even start looking would be appreciated.
The app works just fine when running webrick.
The jRuby stack still has a long way to go. Finally figured this debacle out. Turns out the rackup.rb file pulled into glassfish from an as yet unidentified source (I hacked it for now and moved on) has logic that only supports rack in development, test or production. I was using a multistage environment so I could test things out. I had a, shocker, staging environment. So this all worked fine under the old glassfish that detected and ran rails separately but created a host of issues for the rails3 application running with a config.ru rack file.
I will post an update to my blog when I get this nailed down correctly. You can't monkey patch this because glassfish loads from the installed gem location not your own project or even bundle repository.