Skip to content

Instantly share code, notes, and snippets.

@mrinterweb
Created December 7, 2008 22:53
Show Gist options
  • Save mrinterweb/33277 to your computer and use it in GitHub Desktop.
Save mrinterweb/33277 to your computer and use it in GitHub Desktop.
Merb.logger.info("Compiling routes...")
Merb::Router.prepare do
resources :posts do
resources :comments
end
#resources :categories
#r.match("/posts/:id/add_comment", method => :post).
# to(:controller => "posts", :action => "add_comment").name(:post_add_comment)
# RESTful routes
# resources :posts
# Adds the required routes for merb-auth using the password slice
slice(:merb_auth_slice_password, :name_prefix => nil, :path_prefix => "")
# This is the default route for /:controller/:action/:id
# This is fine for most cases. If you're heavily using resource-based
# routes, you may want to comment/remove this line to prevent
# clients from calling your create or destroy actions with a GET
default_routes
# Change this for your home page to be available at /
# match('/').to(:controller => 'whatever', :action =>'index')
end
Named Routes
delete_post: /posts/:id/delete(.:format)
posts: /posts(/index)(.:format)
login: /login
post: /posts/:id(.:format)
new_post: /posts/new(.:format)
perform_login: /login
default: /:controller(/:action(/:id))(.:format)
logout: /logout
edit_post: /posts/:id/edit(.:format)
Anonymous Routes
/posts(.:format)
/posts/:id(.:format)
/posts/:id(.:format)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment