Ken, I don't think so. When I create the same application in Rails
3.0.8 migrations do not have any errors. The problem exists only for
Rails 3.1 RC4. And, yes, in both situations I use the same gems
versions:
Well and that is my point. Being an external adapter author myself, I am a witness to exactly how much the activerecord-sqlserver-adapter had to change to support the 3.1 vs 3.0 code base. I would not assume the same adapter version of anything would work 100% moving from ActiveRecord 3.0 to 3.1.
Besides, just reporting problems is not enough. If have the capability some talk around what you think the problem is and even better yet some stabs at a patch would be nice. Also, have you talked to the external adapter's author and/or community too?
c:> jgem list
...
activerecord-jdbcsqlite3-adapter (1.1.1)
rails (3.1.0.rc4)
...
c:> jruby -S rails s
...
ArgumentError: wrong number of arguments (3 for 2)
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
activerecord-3.1.0.rc4/l
ib/active_record/connection_adapters/abstract/database_statements.rb:
9:in `selec
t_all'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
activerecord-3.1.0.rc4/l
ib/active_record/connection_adapters/abstract/query_cache.rb:60:in
`select_all'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
activerecord-3.1.0.rc4/l
ib/active_record/connection_adapters/abstract/query_cache.rb:74:in
`cache_sql'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
activerecord-3.1.0.rc4/l
ib/active_record/connection_adapters/abstract/query_cache.rb:60:in
`select_all'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
activerecord-3.1.0.rc4/l
ib/active_record/base.rb:473:in `find_by_sql'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
activerecord-3.1.0.rc4/l
ib/active_record/relation.rb:109:in `to_a'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
activerecord-3.1.0.rc4/l
ib/active_record/relation/finder_methods.rb:370:in `find_first'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
activerecord-3.1.0.rc4/l
ib/active_record/relation/finder_methods.rb:122:in `first'
from org/jruby/RubyKernel.java:2059:in `send'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
activerecord-3.1.0.rc4/l
ib/active_record/relation/finder_methods.rb:257:in
`find_by_attributes'
from org/jruby/RubyKernel.java:2071:in `send'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
activerecord-3.1.0.rc4/l
ib/active_record/base.rb:1060:in `method_missing'
from (irb):1:in `evaluate'
from org/jruby/RubyKernel.java:1088:in `eval'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ruby-
debug-0.10.4/cli/ru
by-debug/commands/irb.rb:99:in `evaluate'
from c:/java/jruby-1.6.2/lib/ruby/1.8/irb.rb:158:in
`eval_input'
... 78 levels...
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack-
mount-0.8.1/lib/rac
k/mount/route_set.rb:152:in `call'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack-
mount-0.8.1/lib/rac
k/mount/code_generation.rb:111:in `recognize'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack-
mount-0.8.1/lib/rac
k/mount/code_generation.rb:80:in `optimized_each'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack-
mount-0.8.1/lib/rac
k/mount/code_generation.rb:110:in `recognize'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack-
mount-0.8.1/lib/rac
k/mount/route_set.rb:141:in `call'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
actionpack-3.1.0.rc4/lib
/action_dispatch/routing/route_set.rb:531:in `call'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
actionpack-3.1.0.rc4/lib
/action_dispatch/middleware/best_standards_support.rb:17:in `call'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/
rack/etag
.rb:23:in `call'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/
rack/cond
itionalget.rb:25:in `call'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
actionpack-3.1.0.rc4/lib
/action_dispatch/middleware/head.rb:14:in `call'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
actionpack-3.1.0.rc4/lib
/action_dispatch/middleware/params_parser.rb:21:in `call'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
actionpack-3.1.0.rc4/lib
/action_dispatch/middleware/flash.rb:243:in `call'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/
rack/sess
ion/abstract/id.rb:195:in `context'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/
rack/sess
ion/abstract/id.rb:190:in `call'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
actionpack-3.1.0.rc4/lib
/action_dispatch/middleware/cookies.rb:321:in `call'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
activerecord-3.1.0.rc4/l
ib/active_record/query_cache.rb:54:in `call'irb(User):002:0>
I am happy to help out here, if I get some little hints where I can
find these internal API changes from3.0 -> 3.1
a quick fix to get the migration and scaffold application working is
no problem (commenting out the bind parameter in some method calls)
but the moment you start a real application that will not work.
c:>jruby -S rails s
...
ArgumentError: wrong number of arguments (3 for 2)
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/
database_statements.rb:9:in `select_all'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/
query_cache.rb:60:in `select_all'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/
query_cache.rb:74:in `cache_sql'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/
query_cache.rb:60:in `select_all'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
activerecord-3.1.0.rc4/lib/active_record/base.rb:473:in `find_by_sql'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
activerecord-3.1.0.rc4/lib/active_record/relation.rb:109:in `to_a'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
activerecord-3.1.0.rc4/lib/active_record/relation/finder_methods.rb:
370:in `find_first'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
activerecord-3.1.0.rc4/lib/active_record/relation/finder_methods.rb:
122:in `first'
from org/jruby/RubyKernel.java:2059:in `send'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
activerecord-3.1.0.rc4/lib/active_record/relation/finder_methods.rb:
257:in `find_by_attributes'
from org/jruby/RubyKernel.java:2071:in `send'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
activerecord-3.1.0.rc4/lib/active_record/base.rb:1060:in
`method_missing'
from (irb):1:in `evaluate'
from org/jruby/RubyKernel.java:1088:in `eval'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ruby-
debug-0.10.4/cli/ruby-debug/commands/irb.rb:99:in `evaluate'
from c:/java/jruby-1.6.2/lib/ruby/1.8/irb.rb:158:in
`eval_input'
... 78 levels...
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack-
mount-0.8.1/lib/rack/mount/route_set.rb:152:in `call'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack-
mount-0.8.1/lib/rack/mount/code_generation.rb:111:in `recognize'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack-
mount-0.8.1/lib/rack/mount/code_generation.rb:80:in `optimized_each'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack-
mount-0.8.1/lib/rack/mount/code_generation.rb:110:in `recognize'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack-
mount-0.8.1/lib/rack/mount/route_set.rb:141:in `call'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
actionpack-3.1.0.rc4/lib/action_dispatch/routing/route_set.rb:531:in
`call'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
actionpack-3.1.0.rc4/lib/action_dispatch/middleware/
best_standards_support.rb:17:in `call'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/
rack/etag.rb:23:in `call'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/
rack/conditionalget.rb:25:in `call'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
actionpack-3.1.0.rc4/lib/action_dispatch/middleware/head.rb:14:in
`call'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
actionpack-3.1.0.rc4/lib/action_dispatch/middleware/params_parser.rb:
21:in `call'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
actionpack-3.1.0.rc4/lib/action_dispatch/middleware/flash.rb:243:in
`call'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/
rack/session/abstract/id.rb:195:in `context'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/
rack/session/abstract/id.rb:190:in `call'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
actionpack-3.1.0.rc4/lib/action_dispatch/middleware/cookies.rb:321:in
`call'
from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/
activerecord-3.1.0.rc4/lib/active_record/query_cache.rb:54:in
`call'irb(User):002:0>
Ken Collins is correct. It's not that migrations are broken in Rails
3.1 RC4, but rather the ActiveRecord API has changed and the adapter
has not yet caught up.
This issue appears to have already been fixed in the activerecord-jdbc-
adapter source, but there hasn't been a new 1.1.3 release yet, which
isn't surprising given that Rails 3.1 hasn't been released yet. If you
want to run it now, then add the following to your Gemfile:
You’ve probably spotted (and guessed) that my gem string was slightly incorrect and should have read
‘activerecord-jdbc-adapter’ and
not '‘activerecord-jdbcpostgresql-adapter’; but the principle is there.
Doh!
In any case, migrations are working for me with Postgres and the latest JDBC adapter from master.