Module: Dry::RoutingHelpers
- Included in:
- Controller
- Defined in:
- lib/dry/routing_helpers.rb
Instance Method Summary collapse
- #collection_path(resource) ⇒ Object
- #edit_path(record) ⇒ Object
- #form_arguments(record) ⇒ Object
- #new_path(resource) ⇒ Object
- #record_path(record) ⇒ Object
- #relation_path(record, relation) ⇒ Object
Instance Method Details
#collection_path(resource) ⇒ Object
3 4 5 |
# File 'lib/dry/routing_helpers.rb', line 3 def collection_path resource send "#{base_path resource, plural: true}_path" end |
#edit_path(record) ⇒ Object
15 16 17 |
# File 'lib/dry/routing_helpers.rb', line 15 def edit_path record send "edit_#{base_path record.class}_path", *([@parent, record].compact) end |
#form_arguments(record) ⇒ Object
24 25 26 |
# File 'lib/dry/routing_helpers.rb', line 24 def form_arguments record [*current_namespace, @parent, record].compact end |
#new_path(resource) ⇒ Object
11 12 13 |
# File 'lib/dry/routing_helpers.rb', line 11 def new_path resource send "new_#{base_path resource}_path" end |
#record_path(record) ⇒ Object
7 8 9 |
# File 'lib/dry/routing_helpers.rb', line 7 def record_path record send "#{base_path record.class}_path", *([@parent, record].compact) end |
#relation_path(record, relation) ⇒ Object
19 20 21 22 |
# File 'lib/dry/routing_helpers.rb', line 19 def relation_path record, relation send "#{base_path record.class}_#{relation.model_name.route_key}_path", record end |