1. 28 11月, 2017 1 次提交
  2. 24 10月, 2017 1 次提交
  3. 21 10月, 2017 1 次提交
  4. 01 9月, 2017 1 次提交
    • M
      Clarify intentions around method redefinitions · 2e6658ae
      Matthew Draper 提交于
      Don't use remove_method or remove_possible_method just before a new
      definition: at best the purpose is unclear, and at worst it creates a
      race condition.
      
      Instead, prefer redefine_method when practical, and
      silence_redefinition_of_method otherwise.
      2e6658ae
  5. 11 7月, 2017 1 次提交
  6. 07 7月, 2017 1 次提交
  7. 06 7月, 2017 1 次提交
  8. 02 7月, 2017 1 次提交
  9. 01 7月, 2017 3 次提交
  10. 23 6月, 2017 1 次提交
    • J
      Fix missing formats in route-set URLs · 2c030038
      Jonathan del Strother 提交于
      Before this change, handle_positional_args would end up mutating @segment_keys
      if inner_options included path components.  Subsequent calls would then
      be missing the implicit path components.
      
      eg:
      user_path(1, :json)         # => "/users/1.json" (correct)
      user_path(1, format: :json) # => "/users/1.json" (correct, but @segment_keys was mutated)
      user_path(1, :json)         # => "/users/1" (oh no!)
      2c030038
  11. 19 4月, 2017 1 次提交
  12. 18 3月, 2017 2 次提交
    • A
      Always use original url_for when generating direct routes · fd16e1a9
      Andrew White 提交于
      Action View overrides `url_for` in the view context to render paths by
      default when using `url_for` and this means that direct route helpers
      don't get the full url when called with the url suffix. To fix this
      always call the original `url_for`.
      fd16e1a9
    • A
      Add support for calling nested direct routes (#28462) · 35afd2c5
      Andrew White 提交于
      Not all requirements can be expressed in terms of polymorphic url
      options so add a `route_for` method that allows calling another
      direct route (or regular named route) which a set of arguments, e.g:
      
          resources :buckets
      
          direct :recordable do |recording|
            route_for(:bucket, recording.bucket)
          end
      
          direct :threadable do |threadable|
            route_for(:recordable, threadable.parent)
          end
      
      This maintains the context of the original caller, e.g.
      
          threadable_path(threadable) # => /buckets/1
          threadable_url(threadable)  # => http://example.com/buckets/1
      35afd2c5
  13. 16 3月, 2017 1 次提交
    • A
      Remove unnecessary params munging · 886085d6
      Andrew White 提交于
      In 9b654d47 some params munging was added to ensure that they were
      set whenever `recognize_path` would call either a proc or callable
      constraint. Since we no longer mutate the environment hash within
      the method it's now unnecessary and actually causes params to leak
      between route matches before checking constraints.
      
      Fixes #28398.
      886085d6
  14. 14 3月, 2017 1 次提交
  15. 26 2月, 2017 1 次提交
  16. 22 2月, 2017 1 次提交
  17. 21 2月, 2017 8 次提交
    • A
      Split direct method into two · d7c1e62c
      Andrew White 提交于
      Use a separate method called `resolve` for the custom polymorphic
      mapping to clarify the API.
      d7c1e62c
    • A
      Push option extract into call method · fbda6b98
      Andrew White 提交于
      fbda6b98
    • A
      Fix typo in exception message · ef862c04
      Andrew White 提交于
      ef862c04
    • A
      Prefer remove_method over undef_method · c116eaf2
      Andrew White 提交于
      Using `undef_method` means that when a route is removed any other
      implementations of that method in the ancestor chain are inaccessible
      so instead use `remove_method` which restores access to the ancestor.
      c116eaf2
    • A
      Add custom polymorphic mapping · 3bf47b01
      Andrew White 提交于
      Allow the use of `direct` to specify custom mappings for polymorphic_url, e.g:
      
        resource :basket
        direct(class: "Basket") { [:basket] }
      
      This will then generate the following:
      
        >> link_to "Basket", @basket
        => <a href="/basket">Basket</a>
      
      More importantly it will generate the correct url when used with `form_for`.
      
      Fixes #1769.
      3bf47b01
    • A
      Don't allocate a hash unnecessarily · 7d1e7380
      Andrew White 提交于
      7d1e7380
    • A
      Add support for defining custom url helpers in routes.rb · ce7d5fb2
      Andrew White 提交于
      Allow the definition of custom url helpers that will be available
      automatically wherever standard url helpers are available. The
      current solution is to create helper methods in ApplicationHelper
      or some other helper module and this isn't a great solution since
      the url helper module can be called directly or included in another
      class which doesn't include the normal helper modules.
      
      Reference #22512.
      ce7d5fb2
    • A
      Wrap routes.url_helpers.url_for via a proxy · 31dc46cb
      Andrew White 提交于
      The singleton url_for on Rails.application.routes.url_helpers isn't the
      same as the url_for you get when you include the module in your class as
      the latter has support for polymorphic style routes, etc. whereas the
      former accepts only a hash and is the underlying implementation defined
      on ActionDispatch::Routing::RouteSet.
      
      This commit changes the singleton method to call through a proxy instance
      so that it gets the full range of features specified in the documentation
      for url_for.
      31dc46cb
  18. 18 1月, 2017 1 次提交
    • J
      Fully initialize routes before the first request is handled · 5b1332bb
      Jean Boussier 提交于
      `AD::Journey::GTG::Simulator` is lazily built the first time
      `Journey::Router#find_routes` is invoked, which happens when
      the first request is served.
      
      On large applications with many routes, building the simulator
      can take several hundred milliseconds (~700ms for us).
      
      Triggering this initialization during the boot process reduces
      the impact of deploys on the application response time.
      5b1332bb
  19. 29 10月, 2016 1 次提交
  20. 27 10月, 2016 1 次提交
  21. 03 10月, 2016 1 次提交
    • C
      Show an "unmatched constraints" error for mismatching and present params · 0b32e2df
      Chris Carter 提交于
      Currently a misleading "missing required keys" error is thrown when a param
      fails to match the constraints of a particular route. This commit ensures that
      these params are recognised as unmatching rather than missing.
      
      Note: this means that a different error message will be provided between
      optimized and non-optimized path helpers, due to the fact that the former does
      not check constraints when matching routes.
      
      Fixes #26470.
      0b32e2df
  22. 14 9月, 2016 1 次提交
  23. 02 9月, 2016 2 次提交
  24. 16 8月, 2016 1 次提交
  25. 07 8月, 2016 4 次提交
  26. 27 4月, 2016 1 次提交