Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Probable fix for JRUBY-4831: Multiple block args to ActiveRecord asso…

…ciation proxy are splatted incorrectly
  • Loading branch information...
commit c3329e40d9559457431c1ccf6de6f2030ec756ff 1 parent ef19b4a
@headius headius authored
Showing with 10 additions and 1 deletion.
  1. +10 −1 src/org/jruby/RubyEnumerable.java
View
11 src/org/jruby/RubyEnumerable.java
@@ -858,7 +858,16 @@ public EachWithIndex(ThreadContext ctx, Block block) {
}
public IRubyObject call(ThreadContext context, IRubyObject[] iargs, Block block) {
- this.block.call(context, new IRubyObject[] { runtime.newArray(checkArgs(runtime, iargs), runtime.newFixnum(index++)) });
+ switch (iargs.length) {
+ case 0:
+ // FIXME: Does this ever happen?
+ case 1:
+ this.block.call(context, checkArgs(runtime, iargs), runtime.newFixnum(index++));
+ break;
+ case 2:
+ this.block.call(context, runtime.newArrayNoCopy(iargs), runtime.newFixnum(index++));
+ break;
+ }
return runtime.getNil();
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.