Method: Jets::Router#infer_to_option!
- Defined in:
- lib/jets/router.rb
#infer_to_option!(options) ⇒ Object
Can possibly infer to option from the path. Example:
get 'posts/index'
get 'posts', to: 'posts#index'
get 'posts/show'
get 'posts', to: 'posts#show'
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/jets/router.rb', line 43 def infer_to_option!() return if [:to] path = [:path].to_s return unless path.include?('/') items = path.split('/') if items.size == 2 [:to] = items.join('#') end end |