Skip to content

Instantly share code, notes, and snippets.

@carllerche
Created August 21, 2008 20:25
Show Gist options
  • Save carllerche/6631 to your computer and use it in GitHub Desktop.
Save carllerche/6631 to your computer and use it in GitHub Desktop.
Merb::Router.prepare do |r|
r.resources :users do |u|
u.resources :comments
end
end
# --- Will use @comment.id and @comment.user_id
url(:user_comment, @comment) # => /users/123/comments/321
# --- Knows the order of arguments in the route and assigns values accordingly
url(:user_comment, @comment.user, @comment) # => /users/123/comments/321
url(:user_cmment, @comment.user, @comment, :xml) # => /users/123/comments/321.xml
url(:user_comment, @comment)
url(:user_cmment, @comment.user, @comment, :xml)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment