Skip to content

Instantly share code, notes, and snippets.

@jacortinas
Created May 12, 2010 02:21
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 jacortinas/398129 to your computer and use it in GitHub Desktop.
Save jacortinas/398129 to your computer and use it in GitHub Desktop.
SampleBlog.controllers :posts do
get :index, :respond_to => [:html, :rss, :atom] do
@posts = Post.criteria.order_by([:created_at, :desc]).all
case content_type
when :rss, :atom
render 'posts/index', :layout => false
else
render 'posts/index'
end
end
get :show, :with => :id do
@post = Post.find(params[:id])
render 'posts/show'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment