Flowdock
method

add_route

Importance_0
v4.2.1 - Show latest stable - 0 notes - Class: Resources
add_route(action, options) 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_dispatch/routing/mapper.rb, line 1541
        def add_route(action, options) # :nodoc:
          path = path_for_action(action, options.delete(:path))
          raise ArgumentError, "path is required" if path.blank?

          action = action.to_s.dup

          if action =~ /^[\w\-\/]+$/
            options[:action] ||= action.tr('-', '_') unless action.include?("/")
          else
            action = nil
          end

          as = if !options.fetch(:as, true) # if it's set to nil or false
                 options.delete(:as)
               else
                 name_for_action(options.delete(:as), action)
               end

          mapping = Mapping.build(@scope, @set, URI.parser.escape(path), as, options)
          app, conditions, requirements, defaults, as, anchor = mapping.to_route
          @set.add_route(app, conditions, requirements, defaults, as, anchor)
        end
Register or log in to add new notes.