If you ever needed a way to render a Rails assets to a string, Hongli Lai from Phusion describes how. 🙂
I prepared a Gist wrapping it into a nice helper. 😀
# thanks to http://blog.phusion.nl/2011/08/14/rendering-rails-3-1-assets-to-string/
# you may need to change the owner of the tmp/cache/* directories to the web servers user
# e.g. for Debian systems: `chown -R www-data:www-data tmp/cache/*`
Just realized Ruby’s File.basename can also filter out (arbitrary) file extensions. 😀
File.basename("foo/bar/baz.html", ".*") #=> "baz"
Hunting down and fixing this bug took half of my day … 🙁