Why not `root_url.sub(/#{root_path}$/, path_to_image(source))` ?