aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/prefix_generation_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Fix tests, main_app mounted helper must be defined explicitly now.Piotr Sarnacki2011-04-251-0/+1
|
* Allow mounting engines at '/'Piotr Sarnacki2010-09-301-16/+77
| | | | | Without that commit script_name always become '/', which results in paths like //posts/1 instead of /posts/1
* Change app to main_app in mounted_helpersPiotr Sarnacki2010-09-081-3/+3
|
* Do not require passing :app to mounted helpers, it's actually useless and ↵Piotr Sarnacki2010-09-081-1/+1
| | | | not DRY
* Ensure that url_helpers included after application's ones have higher priorityPiotr Sarnacki2010-09-031-0/+15
|
* Add mounted_helpers to routesPiotr Sarnacki2010-09-031-14/+70
| | | | | | | | | | | | | | | | 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-46/+71
| | | | | | | * 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
* Use new url_for API instead of including routes.url_helpersPiotr Sarnacki2010-09-031-3/+2
|
* Added some more tests for url generation between Engine and ApplicationPiotr Sarnacki2010-09-031-10/+28
|
* Refactored tests for prefix generation and added test for url generation in ↵Piotr Sarnacki2010-09-031-11/+32
| | | | regular class with default_url_options[:script_name] set
* New way of generating urls for Application from Engine.Piotr Sarnacki2010-09-031-0/+1
| | | | | | | | | 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.
* Allow to generate Application routes inside EnginePiotr Sarnacki2010-09-031-3/+22
| | | | | | This requires knowledge about original SCRIPT_NAME and the parent router. It should be pass through the env as ORIGIAL_SCRIPT_NAME and action_dispatch.parent_routes
* Use env['action_dispatch.routes'] to determine if we should generate prefix ↵Piotr Sarnacki2010-09-031-0/+102
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.