Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Metal should respect ActionPack class name conventions

#2242

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.

Reported by Luca Guidi · March 15th, 2009 @ 08:45 PM

State: resolved
Milestone: none
Assigned to: josh josh
Importance: none

Activity

  1. Luca Guidi
    Luca Guidi

    Ops, I forgot to say my Metal piece file name is: legacy_routes.rb.

    March 15th, 2009 @ 08:46 PM

  2. Luca Guidi
    Luca Guidi
    • Assigned user set to josh

    March 15th, 2009 @ 08:53 PM

  3. josh
    josh
    • Milestone cleared.
    • State changed from new to open

    March 15th, 2009 @ 11:31 PM

  4. Repository
    Repository
    • State changed from open to resolved

    (from [5f10533949457e3797c8f0b51eb30a9268bceb4d]) Make sure Metal use ActionController class name conventions [#2242 Metal should respect ActionPack class name conventions state:resolved]

    Signed-off-by: Joshua Peek josh@joshpeek.com http://github.com/rails/rails/co...

    March 15th, 2009 @ 11:41 PM