Skip to content

Instantly share code, notes, and snippets.

@gnufied
Created October 3, 2008 11:51
Show Gist options
  • Save gnufied/14549 to your computer and use it in GitHub Desktop.
Save gnufied/14549 to your computer and use it in GitHub Desktop.
I am planning to have sites/slice like functionality in my rails app, so as I can roll quick customizations
for potential clients (like themes, but more than that).
Questions is, for sharing static resources (js,css,images,flash....), I have two options:
1. Keep client specific static files in RAILS_ROOT/sites/client_name/public/{javascripts,images,stylesheets}
and render them through overridden tag helpers. Down side, is, these static resources won't be then accessible via
front end webserver (nginx/apache) and most code I have seen use send_data or something like that to render them.
But the up side is each client specific site/slice is self contained. Such as:
RAILS_ROOT/
|
|--- sites
|
| client_name
|
|-- app/
| |__ controllers
| |__ views
|
|__ public
|__ images
|__ stylesheets
|__ javascripts
2. Another option is, keep them in, RAILS_ROOT/public/sites/client_name/{javascripts,images,stylesheets}
and serve them through overridden tag helpers, if a overriden view is being served, rather than default one.
This way, I think, even front end webserver will be able to serve them. Downside is, if I do this, slices/sites are
not self contained.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment