instance method extract_namespace

Ruby on Rails 2.2.3

Since v2.2.3 Last seen in v2.2.3 Private

Signature

extract_namespace(record_or_hash_or_array)

Remove the first symbols from the array and return the url prefix implied by those symbols.

Parameters

record_or_hash_or_array req
Source
# File actionpack/lib/action_controller/polymorphic_routes.rb, line 187
      def extract_namespace(record_or_hash_or_array)
        return "" unless record_or_hash_or_array.is_a?(Array)

        namespace_keys = []
        while (key = record_or_hash_or_array.first) && key.is_a?(String) || key.is_a?(Symbol)
          namespace_keys << record_or_hash_or_array.shift
        end

        namespace_keys.map {|k| "#{k}_"}.join
      end

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

Defined in ActionController::PolymorphicRoutes

Type at least 2 characters to search.

↑↓ navigate · open · esc close