diff options
author | Andrew White <andrew.white@unboxed.co> | 2017-02-20 20:39:56 +0000 |
---|---|---|
committer | Andrew White <andrew.white@unboxed.co> | 2017-02-21 15:30:47 +0000 |
commit | 960e73a96df55aecfaf196e35df80f8f0121f51d (patch) | |
tree | 17714e73940934d2a94a5ca702660ea44b637395 /actionpack | |
parent | 3bf47b018be912fc7946342315e67b2ac6c33eaf (diff) | |
download | rails-960e73a96df55aecfaf196e35df80f8f0121f51d.tar.gz rails-960e73a96df55aecfaf196e35df80f8f0121f51d.tar.bz2 rails-960e73a96df55aecfaf196e35df80f8f0121f51d.zip |
Add CHANGELOG entry for `direct` method
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/CHANGELOG.md | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md index 327852e75e..73c30aa9b0 100644 --- a/actionpack/CHANGELOG.md +++ b/actionpack/CHANGELOG.md @@ -1,3 +1,42 @@ +* Add the `direct` method to the routing DSL + + This new method allows customization of the routing behavior in two ways: + + 1. Custom url helpers: + + ``` ruby + direct(:apple) { "http://www.apple.com" } + + >> apple_url + => "http://www.apple.com" + ``` + + This has the advantage of being available everywhere url helpers are available + unlike custom url helpers defined in helper modules, etc. + + 2. Custom polymorphic mappings: + + ``` ruby + resource :basket + direct(class: "Basket") { [:basket] } + ``` + + ``` erb + <%= form_for @basket do |form| %> + <!-- basket form --> + <% end %> + ``` + + This generates the correct singular URL for the form instead of the default + resources member url, e.g. `/basket` vs. `/basket/:id`. + + Currently both forms of `direct` do not take anything from the current routing + scope so it's recommended to declare them outside of any `namespace` or `scope` block. + + Fixes #1769. + + *Andrew White* + * Add `ActionDispatch::SystemTestCase` to Action Pack Adds Capybara integration directly into Rails through Action Pack! |