Refactor namespace determination in ModelBuilder

After this commit the code is easier to follow (and faster) - I hope :neckbeard: 
Could you change that to:

``` ruby
name = options[:name]
if name
# ...
```
?

not sure if our rubocop setup catches this now but we should have a rule that assigning in a conditional is not a good practice as it's error prone and actually harder to read (at least for me :)) /cc @chastell