2008-08-30 [長年日記]

_ [rails] M#c vs M::C#index (3)

納得編

ディレクトリに入ってる順番かぁ、なるほど。

これは Rails 側で並べ替えるしかないのかな。そもそもどっちが優先された方がうれしいんだろ? わざわざモジュール付きのコントローラを用意するぐらいだから、そっちの方が優先された方がいいんだよね?

まわりのコードの空気を読むと、こんな感じかなぁ。

class << ActionController::Routing
  class_eval do
    def possible_controllers_with_ordered
      unless @possible_controllers
        possible_controllers_without_ordered
        @possible_controllers = @possible_controllers.sort_by{|c| - c.length}
      end
      @possible_controllers
    end

    alias_method_chain :possible_controllers, :ordered
  end
end
[]

«前の日記(2008-06-30) 最新