Maybe it would be worth asking on the rails mailing lists (perhaps on core) what would be the most "correct" way to distribute an activerecord adapter outside of rails without having to modify any rails code. It doesn't seem there's a good answer right now, and no pages online really discuss how to make a redistributable adapter ( i.e. they all say "now just add the adapter to active_record.rb...."). I agree that we'll eventually want to lean on Rails guys to include the adapter in the release, but it should probably be closer to "done" before then.
On 6/27/06, Nick Sieger <[EMAIL PROTECTED]> wrote:
I added some code into the "init.rb" file of my JDBC plugin to deal
with issues related to the fact that Rails wants to initialize the
database before the plugins. Additionally, the following line of code
will need to be added to config/environment.rb in your Rails
application (inside of the Rails::Initializer block):
config.frameworks -= [:active_record]
What this does is effectively disable initialization of ActiveRecord
until the AR JDBC plugin is loaded. With this in place, I get a
require error when trying to require 'java', which happens during the
initialization of the database connection in the AR JDBC code.
This isn't a good long-term approach. It will probably be better to
package this as a gem and include 'jdbc' in the list of connection
adapters inside of environment.rb. Unfortunately I don't see an easy
way yet of getting this configured without a little bit of mucking
inside of config/environement.rb.
I just tried starting my now-modified app with jruby and got the following:
[14:03:13][~/Projects/rails/jrubyonrails]$ ../../jruby/bin/jruby
script/server webrick
=> Booting WEBrick...
Exception in thread "main" java.lang.Error: unexpected type class
org.jruby.ast.CallNode at
script/../config/../vendor/rails/railties/lib/commands/servers/webrick.rb:[21,21]:[628,634]
at org.jruby.internal.runtime.methods.EvaluateCallable.procArityOf (EvaluateCallable.java:95)
at org.jruby.internal.runtime.methods.EvaluateCallable.<init>(EvaluateCallable.java:57)
at org.jruby.evaluator.EvaluateVisitor$IterNodeVisitor.execute(EvaluateVisitor.java :1292)
at org.jruby.evaluator.EvaluationState.executeNext(EvaluationState.java:262)
at org.jruby.evaluator.EvaluationState.begin(EvaluationState.java:297)
at org.jruby.internal.runtime.methods.EvaluateCallable.internalCall (EvaluateCallable.java:67)
at org.jruby.internal.runtime.methods.AbstractCallable.call(AbstractCallable.java:64)
at org.jruby.runtime.ThreadContext.yield(ThreadContext.java:347)
at org.jruby.evaluator.EvaluateVisitor$Yield2.execute (EvaluateVisitor.java:2020)
at org.jruby.evaluator.EvaluationState.executeNext(EvaluationState.java:262)
at org.jruby.evaluator.EvaluationState.begin(EvaluationState.java:297)
at org.jruby.RubyObject.eval (RubyObject.java:440)
at org.jruby.internal.runtime.methods.DefaultMethod.internalCall(DefaultMethod.java:110)
at org.jruby.internal.runtime.methods.AbstractMethod.call(AbstractMethod.java:51)
at org.jruby.RubyObject.callMethod(RubyObject.java:362)
Anyone seen this?
/Nick
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jruby-devel mailing list
Jruby-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jruby-devel
--
Charles Oliver Nutter @ headius.blogspot.com
JRuby Developer @ www.jruby.org
Application Architect @ www.ventera.com
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ Jruby-devel mailing list Jruby-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jruby-devel