Forum: JRuby JRuby and Rails 2.3 String/Regex issue

Posted by billgloff (Guest)
on 2012-09-05 19:01
(Received via mailing list)
Trying to port my Rails 2.3.14 app over to JRuby 1.6.7 from MRI 
Passenger but
I currently get an error when trying to hit the rails app at any URL:

NoMethodError (undefined method `sub!' for nil:NilClass):
  org/jruby/RubyBasicObject.java:1656:in `method_missing'

I did some digging and found that error is coming from request.rb inside 
of
ActionPack (line 369). Here is the method:

def path
  path = request_uri.to_s[/\A[^\?]*/]
  path.sub!(/\A#{ActionController::Base.relative_url_root}/, '')
  path
end

request_uri returns the path so in this example "/".  Everything works 
as it
should unless I run this in rails console using JRuby, then path is 
always
nil.

JRUBY-HEAD or JRUBY 1.6.7   irb
>> "/".to_s[/\A[^\?]*/]
=> "/"    <------- YAY THIS WORKS LIKE MRI!

JRUBY-HEAD or JRUBY 1.6.7   ruby script/console
>> "/".to_s[/\A[^\?]*/]
=> nil     <------ WHY IS THIS NIL?

Anyone have any idea why only using jruby with my rails project does 
this
regex code not work? any help or comments on this would be appreciated.

Thanks,
Bill Gloff



--
View this message in context: 
http://ruby.11.n6.nabble.com/JRuby-and-Rails-2-3-S...
Sent from the JRuby - User mailing list archive at Nabble.com.
Posted by billgloff (Guest)
on 2012-09-06 18:16
(Received via mailing list)
Figured out that it was an old Rails plugin called 'gibberish' that was
causing my pain (case anyone cares).

-Bill



--
View this message in context: 
http://ruby.11.n6.nabble.com/JRuby-and-Rails-2-3-S...
Sent from the JRuby - User mailing list archive at Nabble.com.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.