Module: InheritedResources::UrlHelpers
- Defined in:
- lib/inherited_resources/url_helpers.rb
Overview
URLHelpers
When you use InheritedResources it creates some UrlHelpers for you. And they handle everything for you.
# /posts/1/comments
resource_url # => /posts/1/comments/#{@comment.to_param}
resource_url(comment) # => /posts/1/comments/#{comment.to_param}
new_resource_url # => /posts/1/comments/new
edit_resource_url # => /posts/1/comments/#{@comment.to_param}/edit
collection_url # => /posts/1/comments
parent_url # => /posts/1
# /projects/1/tasks
resource_url # => /projects/1/tasks/#{@task.to_param}
resource_url(task) # => /projects/1/tasks/#{task.to_param}
new_resource_url # => /projects/1/tasks/new
edit_resource_url # => /projects/1/tasks/#{@task.to_param}/edit
collection_url # => /projects/1/tasks
parent_url # => /projects/1
# /users
resource_url # => /users/#{@user.to_param}
resource_url(user) # => /users/#{user.to_param}
new_resource_url # => /users/new
edit_resource_url # => /users/#{@user.to_param}/edit
collection_url # => /users
parent_url # => /
The nice thing is that those urls are not guessed during runtime. They are all created when you inherit.