2

I have a small set of css items in a db table that I need to turn into a css file to be included on a page. How can I do this in Rails3?

Is there a way I can call this directly from a stylesheet_link tag? Do I need to go through some ruby to open a file and output it in some directory first? Do I do this in a controller?

The css is actually its own model associated to the item using the css.

I do not know and looking for a solution found little yet, so asking here.

EDIT:

Simple when looked at, I was looking toward a sass or less solution and may still, but this is a simple start

2 Answers 2

5

I would create a Controller that retrieves the data from the database that uses a View to render the data to a Cascading Style Sheet.

You could then reference the given URL whenever you need to use the resulting stylesheet.

Sign up to request clarification or add additional context in comments.

Comments

1

This is the easiest way that I have found http://blog.hasmanythrough.com/2007/10/18/simpler-than-dirt-restful-dynamic-css

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.