Skip to content

Instantly share code, notes, and snippets.

@Nakort
Created September 18, 2011 22:34
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 Nakort/1225646 to your computer and use it in GitHub Desktop.
Save Nakort/1225646 to your computer and use it in GitHub Desktop.
Writing code that generates code
[:saved_checkins, :invalid_checkins].each do |name|
controller name do
scope :path => name do
match "/", :action => "index", :as => name
match "/:id", :action => "destroy", :as => name.to_s.singularize, :via => :delete
match "/:id", :action => "create", :as => name.to_s.singularize, :via => :post
match "/:id", :action => "show", :as => name.to_s.singularize, :via => :get
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment