Skip to content

Instantly share code, notes, and snippets.

@Marchino
Created September 13, 2011 08:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Marchino/1213448 to your computer and use it in GitHub Desktop.
Save Marchino/1213448 to your computer and use it in GitHub Desktop.
MM_ITEMS.each do |item_type|
scope "#{item_type.to_s.pluralize}" do
# index items of item_type
match "/" => "items/#{item_type.to_s.pluralize}#index", :as => "#{item_type.to_s.pluralize}"
# show item
match ":title/:id" => "items/#{item_type.to_s.pluralize}#show", :as => "#{item_type.to_s}"
# shipping costs for item
get ":title/:id/shipping_costs" => "items/#{item_type.to_s.pluralize}#shipping_costs", :as => "#{item_type.to_s}_shipping_costs"
# question for item
get ":title/:id/new_question" => "items/#{item_type.to_s.pluralize}#new_question", :as => "new_#{item_type.to_s}_question"
post ":title/:id/new_question" => "items/#{item_type.to_s.pluralize}#create_question", :as => "create_#{item_type.to_s}_question"
# phone call for item
get ":title/:id/new_phone_call" => "items/#{item_type.to_s.pluralize}#new_phone_call", :as => "new_#{item_type.to_s}_phone_call"
post ":title/:id/new_phone_call" => "items/#{item_type.to_s.pluralize}#create_phone_call", :as => "create_#{item_type.to_s}_phone_call"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment