Deirdre Saoirse Moen

Sounds Like Weird

Rails and Stylesheet Links

10 June 2005

RoR has quite a nice little stylesheet link helper, stylesheetlinktag, which generates a stylesheet link if invoked like so:

<%= stylesheet_link_tag ‘style’ %>

I just checked out the rails trunk and, sure enough it’s only a choice of screen or all, rather a problem for those of us who also like to generate print stylesheets (traditionally, I haven’t bothered, but it’s become one of my grumpy points lately). It also really annoys a friend of mine who uses a braille reader.

So I made a little print media thingy for my site (stuck it in helpers/application_helper.rb), and it works, but what I’d rather do is figure out what I need to do in order to submit a patch to rails so that other types can be supported by the framework. This will mean understanding unit testing in rails, which I haven’t quite gotten to yet.

Catch is, there is no canonical list, so it’s not like you can have a unit test double-check against a specific list of types; someone can go and define a media type of “beelzebub” and you’ve gotta be able to generate that.

I’ll probably be able to do this tomorrow.


Related Posts