Rails2.3.8
class TestController < ApplicationController def index Rails.logger.info(request.path_parameters[:action]) => "index" Rails.logger.info(request.path_parameters["action"]) => "index" Rails.logger.info(request.symbolized_path_parameters[:action]) => "index" Rails.logger.info(request.symbolized_path_parameters["action"]) => "" end end
Rails3.0.0
class TestController < ApplicationController def index Rails.logger.info(request.path_parameters[:action]) => "index" Rails.logger.info(request.path_parameters["action"]) => "" Rails.logger.info(request.symbolized_path_parameters[:action]) => "index" Rails.logger.info(request.symbolized_path_parameters["action"]) => "" end end
path_parametersはString、symbolized_path_parametersはSymbolをキーとして受け付ける仕様だが、Rails3のpath_parametersが文字列を受け付けなくなっている。
ところで、シンボルがキーなのに、文字列でも値を返すのはどういう事か調べると ActiveSupport::HashWithIndifferentAccess という文字列とシンボルを区別しないHashのサブクラスがあるようだ。