Module: InheritedResources::Helpers::ResourcesUrlFor
- Includes:
- UrlFor
- Defined in:
- lib/inherited_resources/helpers/resources_url_for.rb
Class Method Summary collapse
Instance Method Summary collapse
- #edit_parent_url(*resources) ⇒ Object
- #edit_url(*resources) ⇒ Object
- #index_parent_url(*resources) ⇒ Object
- #index_url(*resources) ⇒ Object (also: #resources_url)
- #new_parent_url(*resources) ⇒ Object
- #new_url(*resources) ⇒ Object
- #show_parent_url(*resources) ⇒ Object
- #show_url(*resources) ⇒ Object (also: #resource_url, #destroy_url)
Class Method Details
.included(base) ⇒ Object
6 7 8 |
# File 'lib/inherited_resources/helpers/resources_url_for.rb', line 6 def self.included(base) base.send(:helper_method, public_instance_methods(false) + UrlFor.public_instance_methods(false)) end |
Instance Method Details
#edit_parent_url(*resources) ⇒ Object
46 47 48 49 50 |
# File 'lib/inherited_resources/helpers/resources_url_for.rb', line 46 def edit_parent_url(*resources) resources, = normalize_parent_resources_for_url(resources) { parent_resources } resources.unshift(:edit) polymorphic_url(resources, ) end |
#edit_url(*resources) ⇒ Object
25 26 27 28 |
# File 'lib/inherited_resources/helpers/resources_url_for.rb', line 25 def edit_url(*resources) resources = normalize_resources_for_url(resources) { self.resources } super(*resources) end |
#index_parent_url(*resources) ⇒ Object
30 31 32 33 |
# File 'lib/inherited_resources/helpers/resources_url_for.rb', line 30 def index_parent_url(*resources) resources = normalize_parent_resources_for_url(resources) { parent_resources[0..-2] << parent_resources.last.class.base_class } polymorphic_url(*resources) end |
#index_url(*resources) ⇒ Object Also known as: resources_url
10 11 12 13 |
# File 'lib/inherited_resources/helpers/resources_url_for.rb', line 10 def index_url(*resources) resources = normalize_resources_for_url(resources) { parent_resources << resource_class } super(*resources) end |
#new_parent_url(*resources) ⇒ Object
35 36 37 38 39 |
# File 'lib/inherited_resources/helpers/resources_url_for.rb', line 35 def new_parent_url(*resources) resources, = *normalize_parent_resources_for_url(resources) { parent_resources[0..-2] << parent_resources.last.class.name.underscore } resources.unshift(:new) polymorphic_url(resources, ) end |
#new_url(*resources) ⇒ Object
15 16 17 18 |
# File 'lib/inherited_resources/helpers/resources_url_for.rb', line 15 def new_url(*resources) resources = normalize_resources_for_url(resources) { parent_resources << resource_class.name.underscore } super(*resources) end |
#show_parent_url(*resources) ⇒ Object
41 42 43 44 |
# File 'lib/inherited_resources/helpers/resources_url_for.rb', line 41 def show_parent_url(*resources) resources = normalize_parent_resources_for_url(resources) { parent_resources } polymorphic_url(*resources) end |
#show_url(*resources) ⇒ Object Also known as: resource_url, destroy_url
20 21 22 23 |
# File 'lib/inherited_resources/helpers/resources_url_for.rb', line 20 def show_url(*resources) resources = normalize_resources_for_url(resources) { self.resources } super(*resources) end |