Class: ActionDispatch::Routing::Mapper
- Inherits:
-
Object
- Object
- ActionDispatch::Routing::Mapper
- Defined in:
- lib/support/action_dispatch/routing/mapper.rb
Overview
Re-open ActionDispatch::Routing::Mapper to add route helpers for Wallaby.
Instance Method Summary collapse
-
#wallaby_mount(options, &block) ⇒ Object
Mount Wallaby::Engine at given path.
-
#wresource(*resource_names, &block) ⇒ Object
Generate resourceful routes that works for Wallaby.
-
#wresources(*resource_names, &block) ⇒ Object
Generate resourceful routes that works for Wallaby.
Instance Method Details
#wallaby_mount(options, &block) ⇒ Object
Mount Wallaby::Engine at given path. And prepend custom routes to Rails app if block is given.
26 27 28 29 30 |
# File 'lib/support/action_dispatch/routing/mapper.rb', line 26 def wallaby_mount(, &block) # define routes under namespace (e.g. `:admin`) before mounting the {Wallaby:Engine} (e.g. at `/admin`) namespace([:at][1..] || '', .except(:at), &block) if block mount Wallaby::Engine, .slice(:at, :as, :via) end |
#wresource(*resource_names, &block) ⇒ Object
Generate resourceful routes that works for Wallaby.
66 67 68 69 70 71 72 |
# File 'lib/support/action_dispatch/routing/mapper.rb', line 66 def wresource(*resource_names, &block) = Wallaby::Utils.clone resource_names. resource_names.each do |resource_name| = resource_name, resource resource_name, , &block end end |
#wresources(*resource_names, &block) ⇒ Object
Generate resourceful routes that works for Wallaby.
45 46 47 48 49 50 51 |
# File 'lib/support/action_dispatch/routing/mapper.rb', line 45 def wresources(*resource_names, &block) = Wallaby::Utils.clone resource_names. resource_names.each do |resource_name| = resource_name, resources resource_name, , &block end end |