Hi Daniel,

Great analysis! Could you please submit a jira issue for that, with
some minimized example that shows the differences between MRI and
JRuby (otherwise, I'm not fully sure that I properly understand the
test case from your description).

Once we have the test, the fix should be (hopefully) simple. And, we
could put the test case  into rubyspecs too.

Thanks,
  --Vladimir

On Wed, May 14, 2008 at 11:55 AM, Daniel Hahn <[EMAIL PROTECTED]> wrote:
> Hi everyone,
>
> I just got started on JRuby, and tried to run our Rails application with it.
> I ran into a problem, which I debbugged (see description below) - however
> I'm not quite sure what to do with it. The root cause is rails assuming a
> particular quirk of the Dir[...] method, which JRuby doesn't replicate. So I
> have monkeypatched my Rails for now, but I'm not sure if this should be
> "fixed" in JRuby or taken to Rails...
>
> Problem description:
>
> JRuby interferes with routing where there is the following arrangement of
> controllers
>
>    * something_controller.rb
>    * something/ +- sub_controller.rb
>
> this will not correctly match the 'something/sub' controller. The reason
> being:
>
>    * The Route#recognize method will engage in creating meta-methods that
> match against regular expressions. (From Route#write_recognition)
>    * For the default route, this will eventually land in
> ControllerSegment#regexp_chunk?
>    * This will query Routing#possible_controllers
>    * This method will collect the file paths from the controllers, using
> Dir.../**/*_controller.rb"
>
> The controllers are then put into the regular expression.
>
> For MRI, the Dir method reports files in subdirectories first. The JRuby
> implementation does not.
>
> As a result the 'something' is put into the regexp first, and
> 'something/sub' is matched as (something)/(sub). For MRI, 'something/sub' is
> tested first, and it is correctly matched as (something/sub).
>
> Ciao,
>                Daniel
>
>
> --
> Daniel Hahn
> Software Architect
> [EMAIL PROTECTED]
>
> Net7
> Via Marche 8a - 56123 Pisa
> http://www.netseven.it/
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>   http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to