Skip to content

Instantly share code, notes, and snippets.

@dyoder
Created July 23, 2008 02:02
Show Gist options
  • Save dyoder/1464 to your computer and use it in GitHub Desktop.
Save dyoder/1464 to your computer and use it in GitHub Desktop.
class Default
def add ; action( :create ) and redirect( paths.show ) ; end
def update
action( :update, name ) and redirect( resource( :site ).paths.main )
end
def delete
action( :delete, name ) and redirect( resource( :site ).paths.main )
end
def edit ; action( :find, name ) and render( :editor ) } ; end
def show ; action( :find, name ) and render( :show ) ; end
end
# add a new content object
map :add, :post => [ 'admin', :resource => /#{resource}/ ]
map :update, :post => [ 'admin', :resource => /#{resource}/, :name ]
map :delete, :delete => [ 'admin', :resource => /#{resource}/, :name ]
map :edit, :get => [ 'admin', :resource => /#{resource}/, :name ]
map :show, :get => [ :resource, :name ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment