rails/rails — pull request #11588 by mattyoho (2013-07-25 00:34:33+00:00)
Title: Allow running db:structure:dump and db:structure:load when using Mysql2 and specifying a port in config/database.yml

When using MySQL, the **ActiveRecord** rake tasks `db:structure:dump` and `db:structure:load` rely on calls to `Kernel.system` for shelling out to `mysqldump` and `mysql`. The `Kernel.system` method expects its arguments to be `String`s. However, the `Mysql2` client expects to be passed a numeric port number, which will be given in `database.yml` as a `Fixnum`.

The current code, with a `database.yml` like:

```yaml
development:
adapter: mysql2
port: 3306
```

raises an error like:

```shell
$ my-app > rake db:structure:dump
rake aborted!
can't convert Fixnum into String
/Users/matt/code/my-app/vendor/gems/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/tasks/mysql_database_tasks.rb:63:in `system'
/Users/matt/code/my-app/vendor/gems/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/tasks/mysql_database_tasks.rb:63:in `structure_dump'
/Users/matt/code/my-app/vendor/gems/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/tasks/database_tasks.rb:142:in `structure_dump'
/Users/matt/code/my-app/vendor/gems/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/railties/databases.rake:288:in `block (3 levels) in '
Tasks: TOP => db:structure:dump
(See full trace by running task with --trace)
```

This PR casts all the arguments intended to be passed to `Kernel.system` to `String`s inside of `prepare_command_options`.