For anyone who uses Knockout JS and publishes their images to a CDN, I have created a gem which should simplify your life somewhat.
Knockout Assets handles the image paths in a way that leaves the templates untouched by Rails, so no server side processing is required.
Have a go and let me know what you think...
Harry