Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use with ActiveRecord #11

Closed
dwbutler opened this issue Dec 3, 2013 · 8 comments
Closed

Can't use with ActiveRecord #11

dwbutler opened this issue Dec 3, 2013 · 8 comments

Comments

@dwbutler
Copy link

dwbutler commented Dec 3, 2013

I tried using this gem as a drop-in replacement for pg while attempting to get Discourse to run on JRuby.

Due to this line, the ActiveRecord Postgresql adapter is unable to recognize this gem as satisfying its requirements. I always get:

Gem::LoadError: Specified 'postgresql' for database adapter, but the gem is not loaded. Add `gem 'pg'` to your Gemfile.

I was able to get things to work by forking the gem and editing the gemspec.

I'm not sure what the correct long-term approach is. Either ActiveRecord should be fixed (ideal?), or the gem method itself needs to be patched (ugly?).

@headius
Copy link
Owner

headius commented Dec 5, 2013

Yeah, this is kinda why we'd really like to get jruby-pg rolled into the pg gem, so that dependencies are just resolved as normal.

@headius
Copy link
Owner

headius commented Dec 5, 2013

I just filed this, so hopefully sometime soon we might be able to get a -java version of the pg gem: https://bitbucket.org/ged/ruby-pg/issue/177/incorporate-jruby-version-of-pg-gem-for-a

In the short term, one thing you could do to help us would be to clone jruby-pg and modify it to produce a pg-####-java.gem instead of jruby-pg-####-java.gem. That should allow your dependencies to resolve and you can see if it works.

@dwbutler
Copy link
Author

dwbutler commented Dec 5, 2013

I was able to get the dependencies to work by changing:

 Gem::Specification.new do |s|
-  s.name = "pg_jruby"
+  s.name = "pg"

I'm also working on some other fixes to make this compatible with Discourse, which I'll probably submit in a separate pull request.

Thanks!

@headius
Copy link
Owner

headius commented Dec 5, 2013

@dwbutler That works too! Thanks for giving this a try. We'd really like to prove the jruby-pg library is ready (or close to ready) for inclusion into the standard pg gem, and the best way to do that (other than running test cases, which @jvshahid has done a lot of) is getting real users trying it out.

This issue isn't really a bug in jruby-pg per se, but we'll leave it open as a placeholder for getting jruby-pg merged into ruby-pg.

@jvshahid
Copy link
Collaborator

jvshahid commented Dec 9, 2013

I'm working on making the gem compatible with version 0.16 of the C pg gem. I'm getting very close to implementing all the new features. As soon as this is done, I'll open a pull request in https://github.com/ged/ruby-pg?source=c to merge my changes.

@jvshahid
Copy link
Collaborator

jvshahid commented May 7, 2014

See ged/ruby-pg#1

@jvshahid jvshahid closed this as completed May 7, 2014
jvshahid pushed a commit that referenced this issue Feb 21, 2015
…-is-empty

Try to use -rpath linker option, even if RbConfig doesn't know about it.
@pmontrasio
Copy link

I run into this problem now, after having seen the announcement of JRuby 9000 and tried to run a Rails 4.2 application with it. I could fork the gem and apply the patch from @dwbutler but haven't been any progresses since December 2013?

@Ch4s3
Copy link

Ch4s3 commented Jul 22, 2015

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants