You operate a terrible clone of about.me
called my.name
. The entire purpose of the site is to show a user's name with some limited styling customization.
You allow users to configure a small number of parameters -- say, background color, font size, and some other properties -- and you store this information with each user.
When a request is made for my.name/123
, you look up the user with id 123 and show that name in the middle of the page. The customized styling associated with each user is in the form of a CSS file that looks like styles.css?user_id=123
. The CSS served is the same for any page; only the values for a few of the fields will be different for a given user_id.
You're using Rails 3.2 and Compass, so you want styles.css
to actually be a dynamic file that generates an asset in the pipeline and which can be easily cached (so that you're not constantly recomputing styles.css?user_id=...
for a given user).
What do you do?
One idea would be to have app/views/styles/user.scss.erb along with a StylesController that serves up that file.
I would suggest avoiding app/assets, since the default is to evaluate the erb during assets:precompile, so you'd need to have some special configuration and routes to serve up a file from there at runtime (which would only confuse devs who understand the pipeline).