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?
@phillipkoebbe: I'm not sure I like the "it's really a file" approach because that's not portable (you can no longer just deploy and have it work, since you'd also need to remember the files, and you definitely don't want those in source control) and it requires you to consider a special case ("has the file been generated yet?"). But it's definitely expedient! Thanks for the suggestion.
@btaitelb: The controller approach seems like the way to go and is the one I'm most strongly considering. It nevertheless feels like a bit of a hack to me because now I have CSS that lives under
styles
instead of, e.g.,public/assets/...
or what have you.