Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | `add` will remove the method if it exists already | Aaron Patterson | 2014-07-30 | 1 | -1/+0 |
| | |||||
* | Deprecate `*_path` methods in mailers | @schneems and @sgrif | 2014-07-30 | 1 | -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 Patterson | 2014-07-29 | 1 | -1/+1 |
| | | | | use helpers.include? so we don't get any false positives | ||||
* | ask the named routes collection if the route is defined | Aaron Patterson | 2014-07-29 | 1 | -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 unbounded | Aaron Patterson | 2014-07-29 | 1 | -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_methods | Aaron Patterson | 2014-07-29 | 1 | -7/+7 |
| | | | | after this, we can disconnect @module from the instance | ||||
* | only ask for the routes module once | Aaron Patterson | 2014-07-29 | 1 | -2/+4 |
| | | | | we can cache the module on the stack, then reuse it | ||||
* | eval_block should be private | Aaron Patterson | 2014-07-29 | 1 | -0/+1 |
| | |||||
* | remove the mounted? method | Aaron Patterson | 2014-07-28 | 1 | -5/+1 |
| | | | | | we know the routes should not be "optimized" when mounting an application | ||||
* | pass the route name to define_url_helper | Aaron Patterson | 2014-07-17 | 1 | -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 helpers | Aaron Patterson | 2014-07-17 | 1 | -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 call | Aaron Patterson | 2014-07-16 | 1 | -2/+2 |
| | |||||
* | extract inner options before delegating to the helper | Aaron Patterson | 2014-07-16 | 1 | -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 dispather | Aaron Patterson | 2014-07-15 | 1 | -0/+4 |
| | | | | Now we can override how requests are dispatched in the routeset object | ||||
* | Remove unused param 'separators' from RouteSet#build_path | Mindaugas MozĊĞras | 2014-06-15 | 1 | -2/+2 |
| | |||||
* | pass the parsed path from mapper to the Strexp | Aaron Patterson | 2014-05-29 | 1 | -3/+6 |
| | |||||
* | add an alternate constructor to Strexp that takes a string | Aaron Patterson | 2014-05-29 | 1 | -1/+1 |
| | |||||
* | PARAMETERS_KEY is only used in the request, so move the constant there | Aaron Patterson | 2014-05-27 | 1 | -2/+0 |
| | |||||
* | move path_parameter encoding check to the request object | Aaron Patterson | 2014-05-27 | 1 | -10/+1 |
| | |||||
* | dispatcher doesn't need `call` anymore | Aaron Patterson | 2014-05-27 | 1 | -4/+0 |
| | |||||
* | give all endpoints a superclass | Aaron Patterson | 2014-05-27 | 1 | -3/+10 |
| | |||||
* | pass a request to `matches?` so we can avoid creating excess requests | Aaron Patterson | 2014-05-25 | 1 | -1/+1 |
| | |||||
* | push is_a?(Dispatcher) check in to one place | Aaron Patterson | 2014-05-24 | 1 | -5/+3 |
| | |||||
* | Always construct route objects with Constraint objects | Aaron Patterson | 2014-05-24 | 1 | -1/+1 |
| | |||||
* | unwrap the constraints object on initialization, eliminate loops | Aaron Patterson | 2014-05-24 | 1 | -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 rm | Aaron Patterson | 2014-05-23 | 1 | -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 class | Aaron Patterson | 2014-05-23 | 1 | -2/+1 |
| | |||||
* | pass the correct custom request to the recognize method | Aaron Patterson | 2014-05-23 | 1 | -1/+1 |
| | |||||
* | pull request allocation up one frame | Aaron Patterson | 2014-05-23 | 1 | -1/+3 |
| | |||||
* | stop using PARAMETERS_KEY, and use the accessor on the request object | Aaron Patterson | 2014-05-22 | 1 | -1/+0 |
| | | | | this decouples our code from the env hash a bit. | ||||
* | use symbol keys for path_parameters | Aaron Patterson | 2014-05-22 | 1 | -2/+2 |
| | |||||
* | middle variable is never used, so rm | Aaron Patterson | 2014-05-21 | 1 | -1/+1 |
| | |||||
* | remove dead code. @klass isn't used anymore | Aaron Patterson | 2014-05-21 | 1 | -1/+0 |
| | |||||
* | reuse path formatter from the non-optimized path. | Aaron Patterson | 2014-05-21 | 1 | -6/+1 |
| | | | | | The optimized and non-optimized path share more code now without significant performance degretation | ||||
* | reduce object allocations | Aaron Patterson | 2014-05-21 | 1 | -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 rm | Aaron Patterson | 2014-05-20 | 1 | -1/+1 |
| | |||||
* | fewer hash allocations when calling url_for | Aaron Patterson | 2014-05-20 | 1 | -9/+12 |
| | |||||
* | fix variable names, only pass hashes to the positional args method | Aaron Patterson | 2014-05-20 | 1 | -8/+10 |
| | |||||
* | Only path requirements are relevant to optimized urls | Andrew White | 2014-05-15 | 1 | -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 White | 2014-05-15 | 1 | -0/+2 |
| | |||||
* | _recall should be set to a hash or not set | Aaron Patterson | 2014-05-13 | 1 | -2/+2 |
| | | | | Then we can avoid nil checks | ||||
* | we never call url_for with a block, so rm | Aaron Patterson | 2014-05-13 | 1 | -1/+0 |
| | |||||
* | drop || test for cases that do not need it | Aaron Patterson | 2014-05-13 | 1 | -3/+3 |
| | |||||
* | no need to check for presence, script names can be blank | Aaron Patterson | 2014-05-13 | 1 | -2/+2 |
| | |||||
* | this method should always have a parameter passed to it, so remove the default | Aaron Patterson | 2014-05-13 | 1 | -1/+1 |
| | |||||
* | options should always be passed to url_for | Aaron Patterson | 2014-05-13 | 1 | -2/+2 |
| | |||||
* | calls with :host should still use the optimized path | Aaron Patterson | 2014-05-13 | 1 | -2/+2 |
| | |||||
* | use fewer method calls to determine the url_for options | Aaron Patterson | 2014-05-13 | 1 | -5/+4 |
| | |||||
* | just merge instead of dup and merge | Aaron Patterson | 2014-05-13 | 1 | -2/+1 |
| | |||||
* | the :only_path option is applied by the time the helper is called | Aaron Patterson | 2014-05-13 | 1 | -4/+1 |
| |