This project is archived and is in readonly mode.

#2242 ✓resolved
Luca Guidi

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

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

Referenced by

Pages