aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing/route_set.rb
Commit message (Collapse)AuthorAgeFilesLines
* 1.9 hash syntax changes to docsAvnerCohen2012-10-311-6/+6
|
* Use internal instance variable naming scheme for mounted URL helper proxiesSam Pohlenz2012-09-091-1/+1
|
* refactor route_set `generate_extras` functionalityschneems2012-08-281-17/+9
| | | | | | The result of Generator with or without the @extras instance variable set contains the desired information. Rather than preserving state when initializing the original object, we can simply extract the keys from the resultant parameters. ATP Actionpack, railties
* Add Missing Keys from Journey on failed URL formatschneems2012-08-281-4/+4
| | | | | | | | | | | | | | | | | | | | | | | Many named routes have keys that are required to successfully resolve. If a key is left off like this: <%= link_to 'user', user_path %> This will produce an error like this: No route matches {:action=>"show", :controller=>"users"} Since we know that the :id is missing, we can add extra debugging information to the error message. No route matches {:action=>"show", :controller=>"users"} missing required keys: [:id] This will help new and seasoned developers look closer at their parameters. I've also subclassed the routing error to be clear that this error is a result of attempting to generate a url and not because the user is trying to visit a bad url. While this may sound trivial this error message is misleading and confuses most developers. The important part isn't what's in the options its's what's missing. Adding this information to the error message will make debugging much more obvious. This is the sister pull request of https://github.com/rails/journey/pull/44 which will be required to get they missing keys into the correct error message. Example Development Error in Rails: http://cl.ly/image/3S0T0n1T3421
* 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.
* 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
|
* load active_support/core_ext/object/blank in active_support/railsXavier Noria2012-08-021-1/+0
|
* Fix class_eval without __FILE__ and __LINE__.kennyj2012-07-181-1/+1
|
* Revert "Allow loading external route files from the router"José Valim2012-06-291-2/+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
* 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.
* 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-201-0/+9
| | | | | | | | | | | | | | | | | | 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
* | 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
* | RouteSet: optimize routes generation when globbing is usedBogdan Gusiev2012-05-031-2/+5
| |
* | RouteSet: remove some code dupsBogdan Gusiev2012-05-021-19/+10
| |
* | ActionPack routes: remove some useless code.Bogdan Gusiev2012-05-021-26/+4
| |
* | Allow loading external route files from the routerJose and Yehuda2012-04-251-0/+2
| | | | | | | | | | | | | | | | | | This feature enables the ability to load an external routes file from the router via: draw :filename External routes files go in +config/routes+. This feature works in both engines and applications.
* | Refactor hash creation in routesetCarlos Antonio da Silva2012-04-241-3/+4
| |
* | RouteSet: decomplecting a way to handle positional argsBogdan Gusiev2012-04-241-26/+20
| |
* | RouteSet: simplify routes helpers generation codeBogdan Gusiev2012-04-241-13/+21
| |
* | documents the contract for the argument of AD::Routing::RouteSet#url_forXavier Noria2012-04-051-0/+1
| |
* | Fix url_for when options is nilRafael Mendonça França2012-04-051-1/+1
| | | | | | | | | | RouteSet#url_for was modifying the options hash that belong to the caller
* | don't pass unnecessary argumentSergey Nartimov2012-03-021-2/+2
| |
* | Optimize url helpers.Sergey Nartimov + José Valim2012-03-021-9/+8
| |
* | Optimize path helpers.José Valim2012-03-021-11/+54
| |
* | Fix the assert_recognizes test method so that it works when there areMatt Fawcett2012-02-241-0/+2
| | | | | | | | constraints on the querystring. Issue #2781
* | Avoid inspecting the whole route set, closes #1525José Valim2012-02-231-0/+6
| |
* | Remove reference to rails_legacy_mapper, which isn't compatible with 3.2 #5022johndouthat2012-02-181-2/+1
| |
* | Fix GH #4720. Routing problem with nested namespace and already camelized ↵kennyj2012-02-101-0/+5
| | | | | | | | controller option.
* | Fixed force_ssl redirects to include original query paramsRyan McGeary2012-02-071-0/+1
| | | | | | | | | | | | | | | | | | | | `ActionController.force_ssl` redirects http URLs to their https equivalent; however, when a URL contains a query string, the resulting redirect lacked the original query string. Conflicts: actionpack/lib/action_controller/metal/force_ssl.rb
* | Fix url_for method's behavior when it is called with :controller option ↵kennyj2012-02-071-1/+1
| | | | | | | | | | | | which starts with "/" from multiple nested controller. Closes #3864
* | Merge pull request #3775 from karevn/masterAaron Patterson2012-01-241-1/+2
|\ \ | | | | | | Please pull my changes - they fix a rare problem with tests framework
| * | Fix: when using subdomains and constraints, request params were not passed ↵karevn2011-11-281-1/+2
| | | | | | | | | | | | to constraints callback
* | | Added custom regexps to ASTs that have literal nodes on either side ofAaron Patterson2012-01-231-1/+20
| | | | | | | | | | | | symbol nodes. Fixes #4585
* | | We should finalize the routes as soon as possible and not wait for the ↵José Valim2012-01-061-2/+0
| | | | | | | | | | | | controller to be loaded.
* | | Clean up routes inclusion and add some comments for the next soul that ↵José Valim2012-01-031-30/+37
| | | | | | | | | | | | decides to adventure on this code.
* | | be explicit about where helpers are installedAaron Patterson2011-12-301-1/+1
| | |
* | | stop using __send__ and just module eval in the extensionsAaron Patterson2011-12-291-3/+2
| | |
* | | we know the classes will be a list, so *tell* it to respond to eachAaron Patterson2011-12-291-3/+3
| | | | | | | | | | | | rather than casting
* | | don't need the begin / endAaron Patterson2011-12-291-21/+17
| | |
* | | avoid extra method calls by just defining the delegateAaron Patterson2011-12-291-2/+3
| | |
* | | don't use instance eval, just reference variables so we don't have toAaron Patterson2011-12-291-10/+11
| | | | | | | | | | | | worry about "inspect" marshalling