This project is archived and is in readonly mode.
[PATCH] #controller_path returns empty string in Ruby 1.8.7
Reported by Szymon Nowak | February 22nd, 2010 @ 05:34 PM | in 3.0.2
Actually it returns an empty string in this particular code:
require 'rubygems'
require 'bundler'
Bundler.setup
Bundler.require
require 'action_controller'
name = 'ExamplesController'
class_name = name.camelize
klass = Class.new(ActionController::Base)
Object.const_set(class_name, klass)
controller = klass.new
p controller.class.name
=> "ExamplesController" in Ruby 1.8.7 and 1.9.1
p controller.controller_path
=> "" in Ruby 1.8.7
=> "examples" in Ruby 1.9.1
This problem occurs only in Rails 3.0 (I'm using master branch - that's why bundler is used here). In Rails 2.3.5 it works correctly.
Comments and changes to this ticket
-
Szymon Nowak February 23rd, 2010 @ 09:04 AM
- Tag changed from ruby 1.8.7, 3.0, action_controller to ruby 1.8.7, 3.0, action_controller, patch
For some strange reason in Ruby 1.8.7 at some point class.name is just an empty string, so @controller_path in AbstractController::Base is also set to an empty string.
This patch should fix this problem.
-
Szymon Nowak February 23rd, 2010 @ 09:06 AM
- Title changed from #controller_path returns empty string in Ruby 1.8.7 to [PATCH] #controller_path returns empty string in Ruby 1.8.7
-
José Valim February 23rd, 2010 @ 09:05 PM
- Assigned user set to José Valim
- Milestone cleared.
-
José Valim February 26th, 2010 @ 10:52 AM
- State changed from new to resolved
Just committed a different fix and added tests. Thanks!
-
Repository February 26th, 2010 @ 11:15 AM
(from [bd36418c512acb62c5515a6cbde79ce59dd67b46]) Fix controller_path returnsing an empty string in Ruby 1.8.7 [#4036 status:resolved] http://github.com/rails/rails/commit/bd36418c512acb62c5515a6cbde79c...
-
Jeremy Kemper October 15th, 2010 @ 11:01 PM
- Milestone set to 3.0.2
- Importance changed from to Low
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 4036 [PATCH] #controller_path returns empty string in Ruby 1.8.7 (from [bd36418c512acb62c5515a6cbde79ce59dd67b46]) Fix con...