Skip to content

Instantly share code, notes, and snippets.

@nesquena
Created February 20, 2010 00:06
Show Gist options
  • Save nesquena/309381 to your computer and use it in GitHub Desktop.
Save nesquena/309381 to your computer and use it in GitHub Desktop.
# Before/After filters in padrino
SimpleApp.controllers :posts do
# These are public actions, no authentication required
get :index do; ... end;
get :show, :with => :id do; ... end;
# These actions require being authenticated
group :authenticated do
before { ensure_user_logged_in! }
post :create do; ... end
delete :destroy, :with => :id do; ... end
after { log_user_modifications! }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment