method

possible_controllers

Importance_0
v2.0.3 - Show latest stable - 0 notes - Class: ActionController::Routing
possible_controllers() public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File actionpack/lib/action_controller/routing.rb, line 318
      def possible_controllers
        unless @possible_controllers
          @possible_controllers = []

          paths = controller_paths.select { |path| File.directory?(path) && path != "." }

          seen_paths = Hash.new {|h, k| h[k] = true; false}
          normalize_paths(paths).each do |load_path|
            Dir["#{load_path}/**/*_controller.rb"].collect do |path|
              next if seen_paths[path.gsub(%r{^\.[/\\]}, "")]

              controller_name = path[(load_path.length + 1)..-1]

              controller_name.gsub!(/_controller\.rb\Z/, '')
              @possible_controllers << controller_name
            end
          end

          # remove duplicates
          @possible_controllers.uniq!
        end
        @possible_controllers
      end
Register or log in to add new notes.