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