aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing/route_set.rb
Commit message (Collapse)AuthorAgeFilesLines
* Speed up subdomain and domain calculus.José Valim2010-11-231-14/+6
|
* :subdomain, :domain and :tld_length options can now be used in url_for, ↵Josh Kalderimis2010-11-231-6/+32
| | | | | | allowing for easy manipulation of the host during link generation. Signed-off-by: José Valim <jose.valim@gmail.com>
* Properly reload routes defined in class definitionPiotr Sarnacki2010-09-301-0/+1
| | | | | | | | | | | | | | | | | Sometimes it's easier to define routes inside Engine or Application class definition (e.g. one file applications). The problem with such case is that if there is a plugin that has config/routes.rb file, it will trigger routes reload on application. Since routes definition for application is not in config/routes.rb file routes_reloader will fail to reload application's routes properly. With this commit you can pass routes definition as a block to routes method, which will allow to properly reload it: class MyApp::Application < Rails::Application routes do resources :users end end
* Allow mounting engines at '/'Piotr Sarnacki2010-09-301-1/+1
| | | | | Without that commit script_name always become '/', which results in paths like //posts/1 instead of /posts/1
* Merge remote branch 'miloops/warnings'José Valim2010-09-291-1/+1
|\
| * Use redefine_method instead define_method, it may be already defined.Emilio Tagua2010-09-281-1/+1
| |
| * Move uri parser to AS as URI.parser method to reuse it in AP and ARes.Emilio Tagua2010-09-271-8/+2
| |
* | Move uri parser to AS as URI.parser method to reuse it in AP and ARes.Emilio Tagua2010-09-281-8/+2
| |
* | Fix tests on 1.9.2.José Valim2010-09-281-5/+0
| |
* | Properly initialize variables inside the initialize method.José Valim2010-09-271-3/+8
|/
* Define @_routes inside method, makes more sense and will be initialized when ↵Emilio Tagua2010-09-271-1/+1
| | | | | | called anywhere. Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Remove warning "URI.unescape is obsolete" from actionpack.Emilio Tagua2010-09-271-4/+2
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Merge remote branch 'miloops/warnings'José Valim2010-09-271-2/+12
|\ | | | | | | | | Conflicts: actionpack/lib/action_controller/metal/url_for.rb
| * Remove old method before redefining it.Emilio Tagua2010-09-271-0/+2
| |
| * Remove warning "URI.unescape is obsolete" from actionpack.Emilio Tagua2010-09-271-2/+10
| |
* | Hash#empty? is faster than Enumerable#any? when used on a Hash.thedarkone2010-09-271-1/+1
| |
* | No need to create a separate lambda for each call.thedarkone2010-09-271-15/+14
|/
* Refactor routing methods.Emilio Tagua2010-09-221-6/+1
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Add RouteSet#appendCarl Lerche2010-09-171-4/+12
| | | Allows specifying blocks to the routeset that will get appended after the RouteSet is drawn.
* Change app to main_app in mounted_helpersPiotr Sarnacki2010-09-081-1/+1
|
* Do not require passing :app to mounted helpers, it's actually useless and ↵Piotr Sarnacki2010-09-081-1/+1
| | | | not DRY
* Removed deprecated RouteSet API, still many tests failPiotr Sarnacki2010-09-051-9/+3
|
* Implemented RouteSet#default_scope, which allows to set the scope for the ↵Piotr Sarnacki2010-09-031-2/+6
| | | | entire routes object
* Move RoutesProxy to separate filePiotr Sarnacki2010-09-031-32/+0
|
* This was used only to clear warning in ActionMailer tests, it shouldn't be ↵Piotr Sarnacki2010-09-031-5/+0
| | | | done like that
* Refactor RoutesProxy to avoid using _with_routes in helpersPiotr Sarnacki2010-09-031-1/+1
|
* Refactor ActionMailer to not use hide_actionsPiotr Sarnacki2010-09-031-1/+6
|
* Fix generating urls with mounted helpers in view contextPiotr Sarnacki2010-09-031-1/+1
| | | | | | | | | | There were actually 2 problems with this one: * script_name was added to options as a string and then it was used in RouteSet#url_for with usage of <<, which was changing the original script_name * the second issue was with _with_routes method. It was called in RoutesProxy to modify _routes in view_context, but url_helpers in views is just delegating it to controller, so another _with_routes call is needed there
* For view_context we need to initialize RoutesProxy in context of controller, ↵Piotr Sarnacki2010-09-031-2/+4
| | | | not view, quick fix, I need to dig into it later
* We don't need delegating polymorphic_url and polymorphic_path anymorePiotr Sarnacki2010-09-031-10/+6
|
* Add mounted_helpers to routesPiotr Sarnacki2010-09-031-0/+59
| | | | | | | | | | | | | | | | mounted_helpers are a bit similar to url_helpers. They're automatically included in controllers for Rails.application and each of mounted Engines. Mounted helper allows to call url_for and named helpers for given application. Given Blog::Engine mounted as blog_engine, there are 2 helpers defined: app and blog_engine. You can call routes for app and engine using those helpers: app.root_url app.url_for(:controller => "foo") blog_engine.posts_path blog_engine.url_for(@post)
* Routes refactoring:Piotr Sarnacki2010-09-031-1/+1
| | | | | | | * added more tests for prefix generation * fixed bug with generating host for both prefix and url * refactored url_for method * organized tests for prefix generation
* Extended url_for to handle specifying which router should be used.Piotr Sarnacki2010-09-031-12/+12
| | | | | | | A few examples: url_for Blog::Engine, :posts_path url_for Blog::Engine, @post url_for Blog::Engine, :action => "main", :controller => "index"
* Get rid of :skip_prefix options in routesPiotr Sarnacki2010-09-031-6/+3
|
* New way of generating urls for Application from Engine.Piotr Sarnacki2010-09-031-2/+2
| | | | | | | | | It's based specifying application's script_name with: Rails.application.default_url_options = {:script_name => "/foo"} default_url_options method is delegated to routes. If router used to generate url differs from the router passed via env it always overwrites :script_name with this value.
* Use env['action_dispatch.routes'] to determine if we should generate prefix ↵Piotr Sarnacki2010-09-031-6/+14
| | | | | | | | | | or not. This technique is here to allow using routes from Engine in Application and vice versa. When using Engine routes inside Application it should generate prefix based on mount point. When using Engine routes inside Engine it should use env['SCRIPT_NAME']. In any other case it should generate prefix as env should not be even available.
* Revert "Setup explicit requires for files with exceptions. Removed them from ↵José Valim2010-09-021-1/+0
| | | | | | | | autoloading." Booting a new Rails application does not work after this commit [#5359 state:open] This reverts commit 38a421b34d0b414564e919f67d339fac067a56e6.
* Setup explicit requires for files with exceptions. Removed them from ↵Łukasz Strzałkowski2010-09-021-0/+1
| | | | | | autoloading. Signed-off-by: José Valim <jose.valim@gmail.com>
* Support routing constraints in functional testsAndrew White2010-08-201-2/+2
| | | | | | | | | | Extend assert_recognizes and assert_generates to support passing full urls as the path argument. This allows testing of routing constraints such as subdomain and host within functional tests. [#5005 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Avoid potentially expensive inspect call in router. [#4491 state:resolved]Samuel Lebeau2010-08-031-3/+6
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* options could be of any kind of Hash (Hash, HashWithIndifferentAccess or ↵Santiago Pastorino2010-07-211-1/+1
| | | | OrderedHash) this way we keep the properties of the options passed as an argument
* Fixed a globbed route issue where slashes were being escaped, causing ↵Brian Rose2010-07-211-1/+2
| | | | | | assert_routing to fail. [#5135 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Bump up to rack-mount 0.6.9 and rack-mount-0.6.6.pre removed from ↵Santiago Pastorino2010-07-151-3/+1
| | | | action_dispatch vendor
* When a dynamic :controller segment is present in the path add a Regexp ↵Andrew White2010-07-071-4/+2
| | | | | | | | | | | constraint that allow matching on multiple path segments. Using a namespace block isn't compatible with dynamic routes so we raise an ArgumentError if we detect a :module present in the scope. [#5052 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Recognize should also work with route is wrapped in a constraint.José Valim2010-07-061-0/+2
|
* Fixes for "router" and "routes" terminologyWincent Colaiuta2010-07-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit f7ba614c2db improved the internal consistency of the different means of accessing routes, but it introduced some problems at the level of code comments and user-visible strings. This commit applies fixes on three levels: Firstly, we remove or replace grammatically invalid constructs such as "a routes" or "a particular routes". Secondly, we make sure that we always use "the router DSL" or "the router syntax", because this has always been the official terminology. Finally, we make sure that we only use "routes" when referring to the application-specific set of routes that are defined in the "config/routes.rb" file, we use "router" when referring on a more abstract level to "the code in Rails used to handle routing", and we use "routing" when we need an adjective to apply to nouns such as "url_helpers. Again this is consistent with historical practice and other places in the documentation. Note that this is not a sweep over the entire codebase to ensure consistent usage of language; it is just a revision of the changes introduced in commit f7ba614c2db. Signed-off-by: Wincent Colaiuta <win@wincent.com> Signed-off-by: José Valim <jose.valim@gmail.com>
* Refactor recall parameter normalization [#5021 state:resolved]Andrew White2010-07-031-16/+6
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Fix routes with :controller segment when namespaced [#5034 state:resolved]José Valim2010-07-021-17/+33
|
* Unify routes naming by renaming router to routesPiotr Sarnacki2010-07-021-3/+3
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Tidy up valid conditions in router a bit.José Valim2010-06-281-2/+4
|