Render css in controller

Hi,

I have a model "Script" can be convert to css with #to_css. But "format.css { render css: @script }" in an action's #respond_to will cause an ActionView::MissingTemplate. I think it wants I put a template in view. How can I avoid that? Thanks.

Best regards, Zhi-Qiang Lei zhiqiang.lei@gmail.com

Hi,

I have a model "Script" can be convert to css with #to_css. But "format.css { render css: @script }" in an action's #respond_to will cause an ActionView::MissingTemplate. I think it wants I put a template in view. How can I avoid that? Thanks.

Try adding layout: nil to your arguments.

Walter

Still the same, why it does not behave like json?