with_options to DRY up route creation

/ Published in: Ruby
Save to your folder(s)

used to remove unnecessary duplication of code. Code is from Jamis Buck (http://weblog.jamisbuck.org/2007/1/24/object-with_options)

Copy this code and paste it in your HTML
  1. map.with_options :controller => "message" do |msg|
  2. msg.create_message "/msg/create/:id", :action => "create"
  3. msg.delete_message "/msg/delete/:id", :action => "delete"
  4. msg.message "/msg/:id", :action => "get"
  5. end

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.