Make sure empty string values for code and path are saved as nil value

Since the cart promotion handler expects code and path to be nil. Other solution could be to change the where clauses to search for empty strings, but that would mean updating all specs and factories to set an empty string and I like the nil value better.

Fixes #4059
Fixes #4064