Currently val is converted to a string in master_file#embed in the same way that it is converted to a string if there are query params.  I agree that the permalink method should always return a string.