Skip to content

Instantly share code, notes, and snippets.

@tyler
Created January 9, 2009 00:23
Show Gist options
  • Save tyler/44958 to your computer and use it in GitHub Desktop.
Save tyler/44958 to your computer and use it in GitHub Desktop.
class PostsController
def show
...
respond_to do |format|
format.html
format.css do
render :string => post.css
end
end
end
def index
@posts = Post.find_dem_posts_yo
respond_to do |format|
format.html
format.css do
render :string => @posts.map(&:css).join("\n")
end
end
end
end
...meanwhile, in your layout...
<head>
<%= stylesheet_link_tag post_url(@post, :format => :css) %>
</head>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment