Sha256: f19888cac64f4e1c9e9e16a3dd3a81ce8d52004e9e5a43259a5668689dc3ee9d
Contents?: true
Size: 1.88 KB
Versions: 4
Compression:
Stored size: 1.88 KB
Contents
= collapsed_routes collapsed_routes is a gem to make hierarchical resource routing easier. Here's an example: ActionController::Routing::Routes.draw do |map| map.resources :users do |user| user.resources :posts do |post| post.resources :comments end end end If you execute: require "collapsed_routes" CollapsedRoutes.collapsed_routes :users, :posts, :comments This will generate the following url_helpers: def comment_path(comment = @comment) user_post_comment_path(comment.post.user, comment.post, comment) end def edit_comment_path(comment = @comment) edit_user_post_comment_path(comment.post.user, comment.post, comment) end def new_comment_path(post = @post) new_user_post_comment_path(post.user, post) end def comments_path(post = @post) user_post_comments_path(post.user, post) end def comment_url(comment = @comment) user_post_comment_url(comment.post.user, comment.post, comment) end def edit_comment_url(comment = @comment) edit_user_post_comment_url(comment.post.user, comment.post, comment) end def new_comment_url(post = @post) new_user_post_comment_url(post.user, post) end def comments_url(post = @post) user_post_comments_url(post.user, post) end def post_path(post = @post) user_post_path(post.user, post) end def edit_post_path(post = @post) edit_user_post_path(post.user, post) end def new_post_path(user = @user) new_user_post_path(user) end def posts_path(user = @user) user_posts_path(user) end def post_url(post = @post) user_post_url(post.user, post) end def edit_post_url(post = @post) edit_user_post_url(post.user, post) end def new_post_url(user = @user) new_user_post_url(user) end def posts_url(user = @user) user_posts_url(user) end == Copyright Copyright (c) 2009 Kyle Maxwell. See LICENSE for details.
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
fizx-collapsed_routes-1.0.2 | README.rdoc |
fizx-collapsed_routes-1.1.0 | README.rdoc |
fizx-collapsed_routes-1.2.0 | README.rdoc |
fizx-collapsed_routes-1.3.0 | README.rdoc |