aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing
Commit message (Collapse)AuthorAgeFilesLines
* Add mailer previews feature based on mail_view gemAndrew White2013-12-171-1/+1
|
* Spelling and Grammar checksAkshay Vishnoi2013-12-121-1/+1
|
* Fix mounting engines inside a resources blockPiotr Sarnacki2013-12-101-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | When a route is mounted inside a resources block, it's automatically prefixed, so a following code: resources :users do mount Blog::Engine => '/blog' end will generate a user_blog path helper. In order to access engine helpers, we also use "mounted_helpers", a list of helpers associated with each mounted engine, so a path to blog's post can be generated using user_blog.post_path(user, post). The problem I'm fixing here is that mount used a raw :as option, without taking nestings into account. As a result, blog was added to a route set as a `user_blog`, but helper was generated for just `blog`. This commit applies the proper logic for defining a helper for a mounted engine nested in resources or resource block. (closes #8533)
* Try to escape each part of a path redirect route correctlyAndrew White2013-12-021-8/+25
| | | | | | | | | | | | | A path redirect may contain any and all parts of a url which have different escaping rules for each part. This commit tries to escape each part correctly by splitting the string into three chunks - path (which may also include a host), query and fragment; then it applies the correct escape pattern to each part. Whilst using `URI.parse` would be better, unfortunately the possible presence of %{name} parameters in the path redirect string prevents us from using it so we have to use a regular expression instead. Fixes #13110.
* Merge remote-tracking branch 'docrails/master'Xavier Noria2013-11-241-1/+1
|\ | | | | | | | | | | Conflicts: activesupport/lib/active_support/core_ext/hash/deep_merge.rb activesupport/lib/active_support/core_ext/hash/keys.rb
| * Change syntax format for example returned valuesPrem Sichanugrist2013-11-111-1/+1
| | | | | | | | | | | | | | | | | | According to our guideline, we leave 1 space between `#` and `=>`, so we want `# =>` instead of `#=>`. Thanks to @fxn for the suggestion. [ci skip]
* | Fix for routes taskSıtkı Bağdat2013-11-211-1/+2
| | | | | | | | This commit fixes formatting issue for `rake routes` task, when a section is shorter than a header.
* | Avoid hash lookups for building an array of required defaultsCarlos Antonio da Silva2013-11-151-2/+3
| | | | | | | | Only set the value once after it's calculated.
* | Get rid of useless temp variableCarlos Antonio da Silva2013-11-151-2/+1
| |
* | Set values instead of building hashes with single values for mergingCarlos Antonio da Silva2013-11-151-2/+2
| |
* | Take Hash with options inside Array in #url_forAndrey Ognevsky2013-11-151-0/+2
| |
* | avoiding next statementsAkshay Vishnoi2013-11-151-9/+12
| |
* | Improve Errors when Controller Name or Action isn't specfiedGaurish Sharma2013-11-051-2/+4
|/ | | | | | | | | | These errors occur when, there routes are wrongly defined. example, the following line would cause a missing :action error root "welcomeindex" Mostly beginners are expected to hit these errors, so lets improve the error message a bit to make their learning experience bit better.
* Respect `SCRIPT_NAME` when using `redirect` with a relative pathAndrew White2013-10-101-0/+18
| | | | | | | | | | | | | | | | Example: # application routes.rb mount BlogEngine => '/blog' # engine routes.rb get '/admin' => redirect('admin/dashboard') This now redirects to the path `/blog/admin/dashboard`, whereas before it would've generated an invalid url because there would be no slash between the host name and the path. It also allows redirects to work where the application is deployed to a subdirectory of a website. Fixes #7977
* Merge branch 'master' of github.com:rails/docrailsVijay Dev2013-09-281-1/+1
|\
| * Fix link_to return valueEarl J St Sauver2013-09-221-1/+1
| | | | | | | | | | | | The documentation is showing the link_to method as just returning the contents of the url_for method. It should be returning an "<a>" tag with the correct href set.
* | Merge pull request #10773 from wangjohn/link_and_routing_optionsRafael Mendonça França2013-09-231-0/+13
|\ \ | | | | | | | | | Adding documentation and tests to ``polymorphic_url`` and ``link_to``
| * | Adding documentation to +polymorphic_url+wangjohn2013-06-131-0/+13
| | | | | | | | | | | | | | | | | | | | | concerning the options that it inherits from +url_for+. The way that +polymorhpic_url+ is built allows it to have options like +:anchor+, +:script_name+, etc. but this is currently not documented.
* | | Merge pull request #12216 from suginoy/a-anRafael Mendonça França2013-09-132-2/+2
|\ \ \ | | | | | | | | Fix typos: the indefinite articles(a -> an).
| * | | Fix typos: the indefinite articles(a -> an)SUGINO Yasuhiro2013-09-132-2/+2
| | | |
* | | | Revert "Merge pull request #12208 from mjhoy/patch-1"Rafael Mendonça França2013-09-121-0/+4
| |_|/ |/| | | | | | | | | | | | | | | | | | | | This reverts commit ab5cd54b7e791f8419f689d1bef5394890268a6f, reversing changes made to cdc10c898d4865302740340eedec4f5f4ca76565. Reason: This way of defining root path is still supported. See https://github.com/rails/rails/blob/d262773ab7f0aae5de2d354ac2eca168e95b653d/actionpack/test/controller/routing_test.rb#L450-457
* | | Merge branch 'master' of github.com:rails/docrailsVijay Dev2013-09-131-10/+10
|\ \ \
| * | | Change documentation to consistently refer to the same objectEarl J St Sauver2013-09-081-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | The documentation in this section is referring to a profile, so the resource that's created should probably also be a profile of some sort.
| * | | Blacklist refferenced in docs is actually whitelistEarl J St Sauver2013-09-081-2/+2
| |/ / | | | | | | | | | | | | | | | The docs refference a blacklist, but really what's being described is a whitelist. Anything that matches the constraint gets through to the path.
* | | remove outdated docsMichael Hoy2013-09-121-4/+0
| | |
* | | Refactor handling of action normalizationMax Shytikov2013-09-101-11/+13
| | | | | | | | | | | | | | | | | | Reference: Bloody mess internals http://gusiev.com/slides/rails_contribution/static/#40
* | | Update mapper documenation for match helper [ci skip]Earl St Sauver2013-08-301-2/+3
|/ / | | | | | | | | | | | | | | This piece of documentation is out of date. The use of match without any via option is prevented, now the HTTP verbs have to be explicitly set. If they're not set then the error message in normalize_conditions! (around line 186) is shown.
* | Revert "Merge branch 'master' of github.com:rails/docrails"Vijay Dev2013-08-171-13/+11
| | | | | | | | | | | | | | This reverts commit 70d6e16fbad75b89dd1798ed697e7732b8606fa3, reversing changes made to ea4db3bc078fb3093ecdddffdf4f2f4ff3e1e8f9. Seems to be a code merge done by mistake.
* | Refactor handling of action normalizationMax Shytikov2013-07-261-11/+13
| | | | | | | | | | | | Reference: Bloody mess internals http://gusiev.com/slides/rails_contribution/static/#40
* | Refactor to reduce number of loopsAndrew White2013-07-171-15/+25
| | | | | | | | | | | | Only build the missing_keys array once we have detected that there actually are missing keys by moving the check to be part of the block that performs the path substitution.
* | Fix failing test missed for the past year :(Andrew White2013-07-171-2/+17
| | | | | | | | | | | | | | | | | | When optimized path helpers were re-introduced in d7014bc the test added in a328f2f broke but no-one noticed because it wasn't being run by the test suite. Fix the test by checking for nil values or empty strings after the args have been parameterized.
* | Fix shorthand routes where controller and action are in the scopeAndrew White2013-06-251-2/+10
|/ | | | | | | | | Merge `:action` from routing scope and assign endpoint if both `:controller` and `:action` are present. The endpoint assignment only occurs if there is no `:to` present in the options hash so should only affect routes using the shorthand syntax (i.e. endpoint is inferred from the the path). Fixes #9856
* `RoutesInspector` deals with routes using regexp as `:controller` optionYves Senn2013-05-301-1/+1
|
* Add has_named_route? to the mapper APIJosé Valim2013-05-201-0/+5
|
* Fix named routing regression from 3.2.13schneems2013-05-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | When named route that is nested is used in 3.2.13 Example `routes.rb`: ``` resources :nested do resources :builder, :controller => 'nested/builder' end ``` In 3.2.12 and 3.2.12 this named route would work: ``` nested_builder_path(:last_step, :nested_id => "foo") ``` Generating a url that looks like `/nested/foo/builder/last_step`. This PR fixes the regression when building urls via the optimized helper. Any explicit keys set in the options are removed from the list of implicitly mapped keys. Not sure if this is exactly how the original version worked, but this fixes this use case regression.
* Rack::Mount was replaced by Journey, Fixed commentGaurish Sharma2013-04-301-1/+1
|
* extract arrays to constants in MapperVipul A M2013-04-221-2/+4
|
* Duplicate options before mutating themAndrew White2013-04-181-3/+4
|
* Mark unused variables and make some style fixesAgis Anastasopoulos2013-04-082-3/+3
| | | | It'd be a nice convention to mark the unused variables like this, now that Ruby 2 will issue no warnings for such vars being unused.
* Refactoring some reused code into a method (inside of the routeswangjohn2013-04-051-12/+13
| | | | mapper) and adding a constant for all the possible scopes.
* Merge pull request #9932 from senny/9913_routing_problemAndrew White2013-04-031-8/+12
|\ | | | | routing bugfixes when matching multiple paths
| * routing shorthand syntax works with multiple pathsYves Senn2013-03-261-5/+6
| | | | | | | | | | | | Closes #9913. We need to expand the match shorthand syntax for every path.
| * bugfix, when matching multiple paths with `get`, `post`, ...Yves Senn2013-03-261-3/+6
| | | | | | | | | | | | This problem was introduced with: https://github.com/rails/rails/commit/d03aa104e069be4e301efa8cefb90a2a785a7bff
* | fix regression in Mapper when `format:` was used in a `scope`.Yves Senn2013-04-031-1/+1
| | | | | | | | | | | | | | Closes #10071 `#normalize_path!` depends on the options so we need to call `#normalize_options!` first to make sure everything is set correctly.
* | fix wrong argument error messageVipul A M2013-03-311-1/+1
|/
* Tweak exception message to avoid giving potentially misleading suggestionsTrevor Turk2013-03-201-2/+3
|
* Raise an ArgumentError when a clashing named route is definedTrevor Turk2013-03-191-1/+8
|
* Routing match `via` option requirement exception message made more explicitBoris Staal2013-03-051-1/+2
|
* Use custom visitor class for optimized url helpersAndrew White2013-03-031-9/+1
| | | | | | | | Rather than trying to use gsub to remove the optional route segments, which will fail with nested optional segments, use a custom visitor class that returns a empty string for group nodes. Closes #9524
* Remove redundant methodAndrew White2013-02-281-8/+0
|