aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing
Commit message (Collapse)AuthorAgeFilesLines
* `RouteSet` should not be listed in the public API [ci skip]Sean Griffin2015-02-031-10/+10
| | | | | The use of `# :startdoc:` inside of the class was overriding the outer-most `# :nodoc:`, causing it to be listed in the documented API.
* Cache `url_helpers` separately for mailersAndrew White2015-02-011-44/+50
| | | | | The commit 3b63780 re-introduced url helper caching but we need to cache a separate module for Action Mailer without paths.
* Cache `url_helpers`eileencodes2015-02-011-42/+44
| | | | | | `url_helpers` used to be memoized. This was lost in a refactoring and this PR adds it back. We noticed this while investigating why integration tests are slower than controller tests.
* Preserve default url options when generating URLsTekin Suleyman2015-01-281-3/+4
| | | | | Fixes an issue that would cause default_url_options to be lost when generating URLs with fewer positional arguments than parameters in the route definition.
* improve performance of integration tests.Aaron Patterson2015-01-271-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I found delegate to be a bottleneck during integration tests. Here is the test case: ```ruby require 'test_helper' class DocumentsIntegrationTest < ActionDispatch::IntegrationTest test "index" do get '/documents' assert_equal 200, response.status end end Minitest.run_one_method(DocumentsIntegrationTest, 'test_index') StackProf.run(mode: :wall, out: 'stackprof.dump') do 3000.times do Minitest.run_one_method(DocumentsIntegrationTest, 'test_index') end end ``` Top of the stack: ``` [aaron@TC integration_performance_test (master)]$ stackprof stackprof.dump ================================== Mode: wall(1000) Samples: 23694 (7.26% miss rate) GC: 1584 (6.69%) ================================== TOTAL (pct) SAMPLES (pct) FRAME 7058 (29.8%) 6178 (26.1%) block in Module#delegate 680 (2.9%) 680 (2.9%) ActiveSupport::PerThreadRegistry#instance 405 (1.7%) 405 (1.7%) ThreadSafe::NonConcurrentCacheBackend#[] 383 (1.6%) 383 (1.6%) Set#include? 317 (1.3%) 317 (1.3%) ActiveRecord::Base.logger 281 (1.2%) 281 (1.2%) Rack::Utils::HeaderHash#[]= 269 (1.1%) 269 (1.1%) ActiveSupport::Notifications::Fanout::Subscribers::Evented#subscribed_to? 262 (1.1%) 262 (1.1%) block (4 levels) in Class#class_attribute 384 (1.6%) 246 (1.0%) block (2 levels) in Class#class_attribute ``` According to @eileencodes's tests, this speeds up integration tests so that they are only 1.4x slower than functional tests: Before: INDEX: Integration Test: 153.2 i/s - 2.43x slower After: INDEX: Integration Test: 275.1 i/s - 1.41x slower
* Fix name_for_action in routingrono232015-01-191-2/+3
|
* Remove unneeded requiresRafael Mendonça França2015-01-042-2/+0
| | | | These requires were added only to change deprecation message
* Remove deprecated usage of string keys in URL helpersRafael Mendonça França2015-01-041-17/+1
|
* Remove deprecated `only_path` option on `*_path` helpersRafael Mendonça França2015-01-041-28/+1
|
* Remove deprecate `*_path` helpers in email viewsRafael Mendonça França2015-01-041-25/+4
|
* Remove deprecated `NamedRouteCollection#helpers`Rafael Mendonça França2015-01-041-8/+0
|
* Remove deprecated support to define routes with `:to` option thatRafael Mendonça França2015-01-041-17/+2
| | | | doesn't contain `#`
* Fix form_for to work with objects that implement to_modelTravis Grathwell2014-12-291-5/+6
| | | | | | | | | | | | | Previously, if you tried to use form_for with a presenter object that implements to_model, it would crash in action_dispatch/routing/polymorphic_routes.rb when asking the presenter whether it is .persisted? Now, we always ask .persisted? of the to_model object instead. This seems to been an issue since 1606fc9d840da869a60213bc889da6fcf1fdc431 Signed-off-by: Eugenia Dellapenna <eugenia.dellapenna@gmail.com>
* Remove ActionController::ModelNamingclaudiob2014-12-251-4/+0
| | | | | | | | | | | | | | The methods in these modules are not used anywhere. They used to be invoked in polymorphic_routes.rb but their usage was removed in e821045. What is your opinion about removing these methods? They do belong to the public API, but in reality their code has already been duplicated to ActionView::ModelNaming, since they are used by methods like `dom_id` and `dom_class` to associated records with DOM elements (in ActionView). Please tell me if you think that removing this module is a good idea and, in that case, if the PR is okay as it is, or you'd rather start by showing a deprecation message, and remove the module in Rails 5.1.
* allow URL helpers to work with optional scopesAlex Robbin2014-12-131-1/+1
|
* Fix handling of positional url helper arguments when format is falseTatiana Soukiassian2014-12-131-2/+8
| | | | | | | There is no need to subtract one from the path_params size when there is no format parameter because it is not present in the path_params array. Fixes #17819.
* Only check that it is a Rails application onceRafael Mendonça França2014-12-081-5/+7
| | | | Also avoid using try since is_a? is faster for this case.
* Mounted Rack apps should have default named routes based on app nameT.J. Schuck2014-12-061-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a regression in 4.2.0 from 4.1.8. https://github.com/rails/rails/pull/17823 fixed a similar regression regarding _explicitly_ named routes for a mounted Rack app, but there was another regression for the default value. With a route like: Rails.application.routes.draw do mount Mountable::Web, at: 'some_route' end The "Prefix" column of rake routes gives the following: - 4.1.8: mountable_web - 4.2.0.beta1-4: [nothing] - 4.2.0.rc1: [nothing] - 4.2.0.rc2: some_route <- regression This fixes the default to go back to being based off the name of the class like the docs specify: https://github.com/rails/rails/blob/785d04e3109f69d0b9b9f4732179592f0ef04e52/actionpack/lib/action_dispatch/routing/mapper.rb#L558-L560 Explicitly named routes still work correctly per https://github.com/rails/rails/pull/17823: Rails.application.routes.draw do mount Mountable::Web, at: 'some_route', as: 'named' end - 4.1.8: named - 4.2.0.beta1-4: [nothing] - 4.2.0.rc1: [nothing] - 4.2.0.rc2: named
* Merge pull request #17862 from lucasmazza/lm-hide-actionRafael Mendonça França2014-12-021-0/+2
| | | | `_generate_paths_by_default` should always be private.
* Merge pull request #17823 from byroot/fix-mount-rack-apps-with-asSean Griffin2014-11-291-7/+1
|\ | | | | Pure rack apps can be mounted with a name
| * Pure rack apps can be mounted with a nameJean Boussier2014-11-291-7/+1
| | | | | | | | See https://github.com/rails/rails/commit/9b15828b5c347395b42066a588c88e5eb4e72279#commitcomment-8764492
* | Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-292-5/+3
|/
* Refactor nested ifBruno Sutic2014-11-261-5/+3
|
* sets script_name to always be a string.JONBRWN2014-11-251-1/+1
| | | | | | | | | | | Closes #17615 #17616 when script_name is nil in the options hash, script_name is set to nil. options = {script_name: nil} script_name = options.delete(:script_name) {‘’} # => nil Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Merge branch 'deprecate-string-options-in-url-helpers'Sean Griffin2014-11-241-1/+17
|\
| * Deprecate string options in URL helpersMelanie Gilman2014-11-241-1/+17
| | | | | | | | | | | | Fixes https://github.com/rails/rails/issues/16958 [Byron Bischoff & Melanie Gilman]
* | let mailer templates generate URLs by default [Xavier Noria, Richard Schneeman]Xavier Noria2014-11-242-2/+12
|/
* Wrap code snippets in +, not backticks, in sdocclaudiob2014-11-201-3/+3
| | | | [ci skip]
* Remove redundant `to_s` in interpolationclaudiob2014-10-301-1/+1
|
* edit pass over all warningsXavier Noria2014-10-282-3/+15
| | | | | | | | | | | | | | | This patch uniformizes warning messages. I used the most common style already present in the code base: * Capitalize the first word. * End the message with a full stop. * "Rails 5" instead of "Rails 5.0". * Backticks for method names and inline code. Also, converted a few long strings into the new heredoc convention.
* let's warn with heredocsXavier Noria2014-10-281-11/+14
| | | | | | | | | | | | The current style for warning messages without newlines uses concatenation of string literals with manual trailing spaces where needed. Heredocs have better readability, and with `squish` we can still produce a single line. This is a similar use case to the one that motivated defining `strip_heredoc`, heredocs are super clean.
* Typos in the deprecation messageGodfrey Chan2014-10-281-2/+2
|
* Deprecate the `only_path` option on `*_path` helpers.Godfrey Chan2014-10-281-2/+26
| | | | | | | | | | | | In cases where this option is set to `true`, the option is redundant and can be safely removed; otherwise, the corresponding `*_url` helper should be used instead. Fixes #17294. See also #17363. [Dan Olson, Godfrey Chan]
* Fix typo in actionpack/lib/action_dispatch/routing/mapper.rbYuutetu2014-10-161-1/+1
|
* Revert "Merge pull request #16966 from why-el/symbolize-path-params"Rafael Mendonça França2014-09-251-1/+0
| | | | | | | | This reverts commit 9d05d6de52871e57bfbf54a60de005e8a5f5b0e4, reversing changes made to 0863c9248fd47a15e88e05ce4fcd80966684c0e3. The change in the behaviour reported at #16958 doesn't exist since 4.0 and 4.1 works in the same way
* Ensure named path params are symbols (Fixes #16958)Mohamed Wael Khobalatte2014-09-251-0/+1
|
* Keep the original implementation to not having to allocate new objectsRafael Mendonça França2014-09-251-2/+15
|
* Remove internal options from query string of pathsGert Goet2014-09-251-18/+3
| | | | Fixes #17057
* Allow polymorphic routes with nil when a route can still be drawnSammy Larbi2014-08-311-1/+2
| | | | | | | | | | | | | | | | Suppose you have two resources routed in the following manner: ```ruby resources :blogs do resources :posts end resources :posts ``` When using polymorphic resource routing like `url_for([@blog, @post])`, and `@blog` is `nil` Rails should still try to match the route to the top-level posts resource. Fixes #16754
* Don't ignore constraints in redirect routesAgis-2014-08-251-2/+0
| | | | | | | | https://github.com/rails/rails/commit/402c2af55053c2f29319091ad21fd6fa6b90ee89 introduced a regression that caused any constraints added to redirect routes to be ignored. Fixes #16605
* Merge pull request #15889 from carnesmedia/model-nameRafael Mendonça França2014-08-171-5/+5
|\ | | | | | | Use #model_name on instances instead of classes
| * Use #model_name on instances instead of classesAmiel Martin2014-06-241-5/+5
| | | | | | | | | | | | This allows rails code to be more confdent when asking for a model name, instead of having to ask for the class. Rails core discussion here: https://groups.google.com/forum/#!topic/rubyonrails-core/ThSaXw9y1F8
* | 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.
* | extract methods and metaprogram less.Aaron Patterson2014-08-141-11/+16
| |
* | ask the scope object if it is a resource_method_scopeAaron Patterson2014-08-131-10/+13
| |
* | ask the scope for the action nameAaron Patterson2014-08-131-14/+18
| |
* | reduce calls to scope_levelAaron Patterson2014-08-131-1/+5
| | | | | | | | | | this will help us to encapsulate magical symbols so hopefully we can eliminate hardcoded magic symbols
* | change to attr_readerAaron Patterson2014-08-131-5/+1
| |
* | scope_level is no longer a hash key, just use the ivarAaron Patterson2014-08-131-4/+9
| |
* | move the scope level key fully inside the scope objectAaron Patterson2014-08-131-1/+5
| |