Updating relationship behaviour

Changes:
* changed $database variable to $connection
* the connection now is set to the current database connection of the
model, unless is otherwise specified.