aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing
Commit message (Collapse)AuthorAgeFilesLines
* Make sure :via works with mountPratik Naik2012-08-201-2/+3
|
* Add CHANGELOG entry and documentation for Routing ConcernsRafael Mendonça França2012-08-131-0/+38
|
* Implementing Routing ConcernsRafael Mendonça França2012-08-131-1/+23
| | | | | | | This pattern was introduced as a plugin by @dhh. The original implementation can be found in https://github.com/rails/routing_concerns
* Further refactor build_conditions in route setCarlos Antonio da Silva2012-08-101-5/+3
| | | | | Return the conditions from the keep_if call, and ignore the value argument since it's not being used.
* Fix handling SCRIPT_NAME from within mounted engine'sPiotr Sarnacki2012-08-111-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When you mount your application at a path, for example /myapp, server should set SCRIPT_NAME to /myapp. With such information, rails application knows that it's mounted at /myapp path and it should generate routes relative to that path. Before this patch, rails handled SCRIPT_NAME correctly only for regular apps, but it failed to do it for mounted engines. The solution was to hardcode default_url_options[:script_name], which is not the best answer - it will work only when application is mounted at a fixed path. This patch fixes the situation by respecting original value of SCRIPT_NAME when generating application's routes from engine and the other way round - when you generate engine's routes from application. This is done by using one of 2 pieces of information in env - current SCRIPT_NAME or SCRIPT_NAME for a corresponding router. This is because we have 2 cases to handle: - generating engine's route from application: in this situation SCRIPT_NAME is basically SCRIPT_NAME set by the server and it indicates the place where application is mounted, so we can just pass it as :original_script_name in url_options. :original_script_name is used because if we use :script_name, router will ignore generating prefix for engine - generating application's route from engine: in this situation we already lost information about the SCRIPT_NAME that server used. For example if application is mounted at /myapp and engine is mounted at /blog, at this point SCRIPT_NAME is equal /myapp/blog. Because of that we need to keep reference to /myapp SCRIPT_NAME by binding it to the current router. Later on we can extract it and use when generating url Please note that starting from now you *should not* use default_url_options[:script_name] explicitly if your server already passes correct SCRIPT_NAME to rack env. (closes #6933)
* RouteSet: refactor internalsBogdan Gusiev2012-08-101-10/+7
| | | | | No need to build valid_conditions array. We can get all the data in place.
* Revert "polymorphic_url with an array generates a query string"Andrew White2012-08-041-4/+1
| | | | | Passing options as the last value in an array doesn't work with form_for. This reverts commit 61c8a4d926343903593a27080216af7e4ed81268.
* Revert "Refactor passing url options via array for polymorphic_url"Andrew White2012-08-041-2/+2
| | | | | Passing options as the last value in an array doesn't work with form_for. This reverts commit 6be564c7a087773cb0b51c54396cc190e4f5c983.
* RouteSet: cleanup some unneeded compexityBogdan Gusiev2012-08-041-16/+7
|
* Renamed _path_segments to _recallBogdan Gusiev2012-08-041-2/+2
|
* Simplify logical statementBogdan Gusiev2012-08-041-4/+2
|
* Merge branch 'polymorphic_url_builds_query_string_with_array'Andrew White2012-08-041-1/+4
|\
| * Refactor passing url options via array for polymorphic_urlAndrew White2012-08-041-2/+2
| | | | | | | | | | | | | | | | Rather than keep the url options in record_or_hash_or_array, extract it and reverse merge with options as it may contain important private keys like `:routing_type`. Closes #7259
| * polymorphic_url with an array generates a query stringRomain Tribes2012-08-041-1/+4
| | | | | | | | | | Generating an URL with an array of records is now able to build a query string if the last item of the array is a hash.
* | Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-08-041-0/+8
|\ \ | |/ |/| | | | | | | Conflicts: activemodel/lib/active_model/secure_password.rb activerecord/lib/active_record/associations/collection_proxy.rb
| * copy edits [ci skip]Vijay Dev2012-08-041-2/+2
| |
| * fix punctuation in #resources and #match documentation [ci skip]Francesco Rodriguez2012-07-311-4/+4
| |
| * Update #match documentation [ci skip]Robert Pankowecki2012-07-311-0/+4
| |
| * Update #resources documentation [ci skip]Robert Pankowecki2012-07-311-0/+4
| |
* | load active_support/core_ext/object/blank in active_support/railsXavier Noria2012-08-022-2/+0
| |
* | fix typo in documentationAnatoly Makarevich2012-07-261-1/+1
|/
* Don't assume resource param is :id when using shallow routesAndrew White2012-07-201-1/+3
| | | | | Since #5581 added support for resources with custom params we should not assume that it is :id when using shallow resource routing.
* Support constraints on resource custom params when nestingAndrew White2012-07-201-8/+12
| | | | | | | The Mapper looks for a :id constraint in the scope to see whether it should apply a constraint for nested resources. Since #5581 added support for resource params other than :id, we need to check for a constraint on the parent resource's param name and not assume it's :id.
* Add support for optional root segments containing slashesAndrew White2012-07-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Optional segments with a root scope need to have the leading slash outside of the parentheses, otherwise the generated url will be empty. However if the route has non-optional elements then the leading slash needs to remain inside the parentheses otherwise the generated url will have two leading slashes, e.g: Blog::Application.routes.draw do get '/(:category)', :to => 'posts#index', :as => :root get '/(:category)/author/:name', :to => 'posts#author', :as => :author end $ rake routes root GET /(:category)(.:format) posts#index author GET (/:category)/author/:name(.:format) posts#author This change adds support for optional segments that contain a slash, allowing support for urls like /page/2 for the root path, e.g: Blog::Application.routes.draw do get '/(page/:page)', :to => 'posts#index', :as => :root end $ rake routes root GET /(page/:page)(.:format) posts#index Fixes #7073
* Fix class_eval without __FILE__ and __LINE__.kennyj2012-07-181-1/+1
|
* Raise a helpful error message on #mount misuseCarl Lerche2012-07-101-0/+4
|
* Rename RouteInspector to RoutesInspectorCarlos Antonio da Silva2012-07-081-1/+1
| | | | Follow the consistency defined in dbc43bc.
* move route_inspector to actionpack@schneems and @mattt2012-07-071-0/+121
| | | | this is so we can show route output in the development when we get a routing error. Railties can use features of ActionDispatch, but ActionDispatch should not depend on Railties.
* Merge pull request #6904 from guilleiguaran/remove-amo-dependency-in-apCarlos Antonio da Silva2012-06-301-7/+7
|\ | | | | Remove Active Model dependency from Action Pack
| * Remove ActiveModel dependency from ActionPackGuillermo Iguaran2012-06-301-7/+7
| | | | | | | | | | | | | | | | ActiveModel is used in ActionPack for ActiveModel::Naming for a few, mostly optional aspects of ActionPack related to automatically converting an ActiveModel compliant object into a key for params and routing. It uses only three methods of ActiveModel (ActiveModel::Naming.route_key, ActiveModel::Naming.singular_route_key and ActiveModel::Naming.param_key).
* | Revert "Allow loading external route files from the router"José Valim2012-06-292-19/+0
|/ | | | | | | | | | | | | | This reverts commit 6acebb38bc0637bc05c19d87f8767f16ce79189b. Usage of this feature did not reveal any improvement in existing apps. Conflicts: actionpack/lib/action_dispatch/routing/mapper.rb guides/source/routing.textile railties/lib/rails/engine.rb railties/lib/rails/paths.rb railties/test/paths_test.rb
* Support unicode character route in config/routes.rb.kennyj2012-06-161-1/+1
|
* Merge pull request #6588 from nbibler/polymorphic_to_modelJosé Valim2012-06-011-1/+7
| | | | Correct the use of to_model in polymorphic routing
* Include routes.mounted_helpers into integration testsPiotr Sarnacki2012-06-011-1/+1
| | | | | | | | | | | | | | | In integration tests, you might want to use helpers from engines that you mounted in your application. It's not hard to add it by yourself, but it's unneeded boilerplate. mounted_helpers are now included by default. That means that given engine mounted like: mount Foo::Engine => "/foo", :as => "foo" you will be able to use paths from this engine in tests this way: foo.root_path #=> "/foo" (closes #6573)
* Simplify logic to initialize valid conditions in RouteSetCarlos Antonio da Silva2012-05-311-7/+3
| | | | | | Remove :to_sym call from public_instance_methods iteration, as such methods in Ruby 1.9 already return symbols. Initialize valid conditions with controller/action instead of setting them afterwards.
* Remove implicit dependency on pathnameJosé Valim2012-05-251-3/+3
|
* Merge pull request #2549 from trek/RoutingErrorForMissingControllersAaron Patterson2012-05-211-3/+7
|\ | | | | When a route references a missing controller, raise ActionController::RoutingError with clearer message
| * When a route references a missing controller, raise ↵Trek Glowacki2011-08-161-3/+7
| | | | | | | | ActionController::RoutingError with a clearer message
* | Return 400 Bad Request for URL paths with invalid encoding.Andrew White2012-05-202-0/+18
| | | | | | | | | | | | | | | | | | Passing path parameters with invalid encoding is likely to trigger errors further on like `ArgumentError (invalid byte sequence in UTF-8)`. This will result in a 500 error whereas the better error to return is a 400 error which allows exception notification libraries to filter it out if they wish. Closes #4450
* | Improve `rake routes` output for redirects - closes #6369.Andrew White2012-05-191-12/+22
| |
* | Fix inspecting route redirections, closes #6369Łukasz Strzałkowski2012-05-181-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | This commit fixes route inspection in `rake routes` Before: foo /foo(.:format) :controller#:action" After: foo /foo(.:format) Redirect (301)
* | Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-05-152-13/+0
|\ \ | | | | | | | | | | | | Conflicts: actionpack/lib/action_view/helpers/asset_tag_helper.rb
| * | Removing ==Examples and last blank lines of docs from actionpackFrancesco Rodriguez2012-05-152-13/+0
| | |
* | | add tests and external file backtrace for Routing::Mapper#drawKornelius Kalnbach2012-05-151-3/+4
|/ /
* | Copy literal route constraints to defaults - fixes #3571 and #6224.Andrew White2012-05-111-0/+19
| |
* | Don't ignore nil positional arguments for url helpers - fixes #6196.Andrew White2012-05-101-1/+1
| |
* | Refactor Generator class to not rely on in-place editing the controllerAndrew White2012-05-091-5/+10
| |
* | Fix bug when url_for changes controller.Nikita Beloglazov2012-05-091-2/+2
| |
* | Fix that optimized named routes should also work as singleton methods on the ↵Jeremy Kemper2012-05-061-1/+2
| | | | | | | | url_helpers module
* | Force given path to http methods in mapper to skip canonical action checkingCarlos Antonio da Silva2012-05-041-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes the following scenario: resources :contacts do post 'new', action: 'new', on: :collection, as: :new end Where the /new path is not generated because it's considered a canonical action, part of the normal resource actions: new_contacts POST /contacts(.:format) contacts#new Fixes #2999