I think this logic should probably for better or worse go into the static_url method, because every other thing that calls .generate has the logic in it too.  Or at very least if this logic lives here, the other things that call .generate should be able to just pass along _foo values too.