aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing/route_set.rb
Commit message (Collapse)AuthorAgeFilesLines
* Deprecate NamedRouteCollection#helpers.Lucas Mazza2014-08-171-0/+5
| | | | | | This method was removed at 210b338db20b1cdd0684f40bd78b52ed16148b99 but it is used by third party gems to check if a named route was defined. To help on the upgrade path on 4.2.0 we bring it back and emit a deprecation warning.
* avoid testing only_pathAaron Patterson2014-08-041-0/+4
| | | | | we know that this call only wants the path returned, so lets call a method that returns the path.
* always return a string from find_script_nameAaron Patterson2014-08-011-2/+2
| | | | this allows us to avoid nil checks on the return value
* do a hash lookup for collision detectionAaron Patterson2014-07-311-0/+4
| | | | hash lookup should be faster than searching an array.
* remove useless deupAaron Patterson2014-07-301-1/+1
| | | | | every call to default_resources_path_names allocates a new hash, no need to dup
* remove alias_method_chainAaron Patterson2014-07-301-4/+2
| | | | we can `super` in to the previous implementation.
* avoid instrospection on the moduleAaron Patterson2014-07-301-1/+2
| | | | | we already know what helpers are path helpers, so just iterate through that list and define the helpers with warnings
* fix variable nameAaron Patterson2014-07-301-3/+3
|
* split path_helpers and url_helpersAaron Patterson2014-07-301-18/+25
| | | | | this lets us avoid hard coding a regexp for separating path and url helpers in the clear! method.
* `add` will remove the method if it exists alreadyAaron Patterson2014-07-301-1/+0
|
* Deprecate `*_path` methods in mailers@schneems and @sgrif2014-07-301-48/+72
| | | | | | | | | | | Email does not support relative links since there is no implicit host. Therefore all links inside of emails must be fully qualified URLs. All path helpers are now deprecated. When removed, the error will give early indication to developers to use `*_url` methods instead. Currently if a developer uses a `*_path` helper, their tests and `mail_view` will not catch the mistake. The only way to see the error is by sending emails in production. Preventing sending out emails with non-working path's is the desired end goal of this PR. Currently path helpers are mixed-in to controllers (the ActionMailer::Base acts as a controller). All `*_url` and `*_path` helpers are made available through the same module. This PR separates this behavior into two modules so we can extend the `*_path` methods to add a Deprecation to them. Once deprecated we can use this same area to raise a NoMethodError and add an informative message directing the developer to use `*_url` instead. The module with warnings is only mixed in when a controller returns false from the newly added `supports_relative_path?`. Paired @sgrif & @schneems
* oops! :bomb:Aaron Patterson2014-07-291-1/+1
| | | | use helpers.include? so we don't get any false positives
* ask the named routes collection if the route is definedAaron Patterson2014-07-291-0/+4
| | | | | we should not be accessing internals to figure out if a method is defined.
* helpers should be a Set so it doesn't grow unboundedAaron Patterson2014-07-291-4/+12
| | | | | since helpers is a set, we can be confident about when to remove methods from the module.
* pass the module to define_named_route_methodsAaron Patterson2014-07-291-7/+7
| | | | after this, we can disconnect @module from the instance
* only ask for the routes module onceAaron Patterson2014-07-291-2/+4
| | | | we can cache the module on the stack, then reuse it
* eval_block should be privateAaron Patterson2014-07-291-0/+1
|
* remove the mounted? methodAaron Patterson2014-07-281-5/+1
| | | | | we know the routes should not be "optimized" when mounting an application
* pass the route name to define_url_helperAaron Patterson2014-07-171-21/+21
| | | | | this allows us to avoid 2 hash allocations per named helper definition, also we can avoid a `merge` and `delete`.
* use a strategy object for generating urls in named helpersAaron Patterson2014-07-171-13/+24
| | | | | | since we know that the route should be a path or fully qualified, we can pass a strategy object that handles generation. This allows us to eliminate an "if only_path" branch when generating urls.
* we do not need to dup the options hash, it is private and a new object each callAaron Patterson2014-07-161-2/+2
|
* extract inner options before delegating to the helperAaron Patterson2014-07-161-7/+13
| | | | | If we extract the options from the user facing method call ASAP, then we can simplify internal logic.
* RouteSet should be in charge of constructing the dispatherAaron Patterson2014-07-151-0/+4
| | | | Now we can override how requests are dispatched in the routeset object
* Remove unused param 'separators' from RouteSet#build_pathMindaugas MozĊĞras2014-06-151-2/+2
|
* pass the parsed path from mapper to the StrexpAaron Patterson2014-05-291-3/+6
|
* add an alternate constructor to Strexp that takes a stringAaron Patterson2014-05-291-1/+1
|
* PARAMETERS_KEY is only used in the request, so move the constant thereAaron Patterson2014-05-271-2/+0
|
* move path_parameter encoding check to the request objectAaron Patterson2014-05-271-10/+1
|
* dispatcher doesn't need `call` anymoreAaron Patterson2014-05-271-4/+0
|
* give all endpoints a superclassAaron Patterson2014-05-271-3/+10
|
* pass a request to `matches?` so we can avoid creating excess requestsAaron Patterson2014-05-251-1/+1
|
* push is_a?(Dispatcher) check in to one placeAaron Patterson2014-05-241-5/+3
|
* Always construct route objects with Constraint objectsAaron Patterson2014-05-241-1/+1
|
* unwrap the constraints object on initialization, eliminate loopsAaron Patterson2014-05-241-1/+1
| | | | | | | Unwrap Constraints objects. I don't actually think it's possible to pass a Constraints object to this constructor, but there were multiple places that kept testing children of this object. I *think* they were just being defensive, but I have no idea.
* glob_param is never used, so rmAaron Patterson2014-05-231-8/+2
| | | | | | this also changes the constructor. We don't need to pass more options than "defaults" (whatever defaults are, ugh. probably another hash of stupid stuff).
* decouple the router object from the request classAaron Patterson2014-05-231-2/+1
|
* pass the correct custom request to the recognize methodAaron Patterson2014-05-231-1/+1
|
* pull request allocation up one frameAaron Patterson2014-05-231-1/+3
|
* stop using PARAMETERS_KEY, and use the accessor on the request objectAaron Patterson2014-05-221-1/+0
| | | | this decouples our code from the env hash a bit.
* use symbol keys for path_parametersAaron Patterson2014-05-221-2/+2
|
* middle variable is never used, so rmAaron Patterson2014-05-211-1/+1
|
* remove dead code. @klass isn't used anymoreAaron Patterson2014-05-211-1/+0
|
* reuse path formatter from the non-optimized path.Aaron Patterson2014-05-211-6/+1
| | | | | The optimized and non-optimized path share more code now without significant performance degretation
* reduce object allocationsAaron Patterson2014-05-211-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Example: x = [1,2,3,4] y = [3,2,1] def test x, y hash = {} x.zip(y) { |k,v| hash[k] = v } hash end def test2 x, y Hash[x.zip(y)] end def test3 x, y x.zip(y).each_with_object({}) { |(k,v),hash| hash[k] = v } end def stat num start = GC.stat(:total_allocated_object) num.times { yield } total_obj_count = GC.stat(:total_allocated_object) - start puts "#{total_obj_count / num} allocations per call" end stat(100) { test(x,y) } stat(100) { test2(x,y) } stat(100) { test3(x,y) } __END__ 2 allocations per call 7 allocations per call 8 allocations per call
* we don't use this parameter for anything, so rmAaron Patterson2014-05-201-1/+1
|
* fewer hash allocations when calling url_forAaron Patterson2014-05-201-9/+12
|
* fix variable names, only pass hashes to the positional args methodAaron Patterson2014-05-201-8/+10
|
* Only path requirements are relevant to optimized urlsAndrew White2014-05-151-1/+1
| | | | | The bit of URL generation that is optimized is the generation of the path so things like :host, :port, etc. are irrelevant.
* Add missing requires for require 'action_dispatch/routing'Andrew White2014-05-151-0/+2
|
* _recall should be set to a hash or not setAaron Patterson2014-05-131-2/+2
| | | | Then we can avoid nil checks