This project is archived and is in readonly mode.

Metal should respect ActionPack class name conventions
Reported by Luca Guidi | March 15th, 2009 @ 08:45 PM
I created a Metal piece for my blog for handle legacy routes:
# Allow the metal piece to run in isolation
require(File.dirname(__FILE__) + "/../../config/environment") unless defined?(Rails)
class LegacyRoutes
  def self.call(env)
    if env["PATH_INFO"] =~ /legacy_routes_regexp/
      [301, {"Location" => "http://example.com"}, nil]
    end
  end
end
When I try to start the server it returns the following error:
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.0/lib/active_support/dependencies.rb:443:in `load_missing_constant': uninitialized constant LegacyRoute (NameError)
# ...
This because in metal.rb classify is
used instead of camelize (http://github.com/rails/rails/bl...).
This is different from ActionController behavior, where
camelize is used (http://github.com/rails/rails/bl...).
I believe Metal should respect ActionPack class name
conventions, i.e. articles_controller.rb =>
ArticlesController". If I'm wrong it should be documented.
:)
I attached a patch for solve this issue.
Comments and changes to this ticket
- 
            
         Luca Guidi March 15th, 2009 @ 08:46 PMOps, I forgot to say my Metal piece file name is: legacy_routes.rb.
- 
            
         Luca Guidi March 15th, 2009 @ 08:53 PM- Assigned user set to josh
 
- 
         josh March 15th, 2009 @ 11:31 PM- Milestone cleared.
- State changed from new to open
 
- 
         Repository March 15th, 2009 @ 11:41 PM- State changed from open to resolved
 (from [5f10533949457e3797c8f0b51eb30a9268bceb4d]) Make sure Metal use ActionController class name conventions [#2242 state:resolved] Signed-off-by: Joshua Peek josh@joshpeek.com http://github.com/rails/rails/co... 
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
- 
         2242 
          Metal should respect ActionPack class name conventions
        (from [5f10533949457e3797c8f0b51eb30a9268bceb4d]) Make su... 2242 
          Metal should respect ActionPack class name conventions
        (from [5f10533949457e3797c8f0b51eb30a9268bceb4d]) Make su...
 josh
      josh
 Luca Guidi
      Luca Guidi