class method self.possible_controllers

Ruby on Rails 2.2.3

Since v2.2.3 Last seen in v2.3.18

Available in: v2.2.3 v2.3.18

Signature

self.possible_controllers()

Returns the array of controller names currently available to ActionController::Routing.

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

Defined in actionpack/lib/action_controller/routing.rb line 318 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionController::Routing

Type at least 2 characters to search.

↑↓ navigate · open · esc close