Question: *Yes, this question has been asked before. 2 years ago. I felt bad about bumping it up, and figured it'd be a better idea to start a new thread.*

Much like the other question's OP, I have generated my Rails app correctly, changed my databases.yml to use MySQL, and still it is trying to use SQLite3. When I run a rake db: command, it works without errors. It generates the tables in the database, but in the browser, the applications keeps giving errors suggesting it is trying to access (/create) a sqlite database.

Has anyone yet found an answer to this issue? My databases.yml:

```
development:
  adapter: mysql2
  host: localhost
  database: robinkanters_dev
  username: [[ correct username ]]
  password: [[ correct password ]]

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: mysql2
  host: localhost
  database: robinkanters_test
  username: [[ correct username ]]
  password: [[ correct password ]]

production:
  adapter: mysql2
  host: localhost
  database: robinkanters_prod
  username: [[ correct username ]]
  password: [[ correct password ]]

```

Robin Kanters

*PS. This is my first time posting on SO, please go easy on me*

EDIT: I figured I didn't really explain the problem.

Answer: 
I have made the assumption that you probably want to translate each digit to itself as well as all the normal letter mappings, plus mapping `0` to `+`. So I made this dictionary to handle the mappings:

```
var map = new Dictionary<char, string>()
{
    { '0', "+0"},
    { '1', "1" },
    { '2', "2ABC"},
    { '3', "3DEF"},
    { '4', "4GHI"},
    { '5', "5JKL"},
    { '6', "6MNO"},
    { '7', "7PQRS"},
    { '8', "8TUV"},
    { '9', "9WXYZ"},
};

```

My permutate function then looks like this:

```
Func<IEnumerable<char>, IEnumerable<IEnumerable<char>>> permutate = null;
permutate = cs =>
{
    var result = Enumerable.Empty<IEnumerable<char>>();
    if (cs.Any())
    {
        result = map[cs.First()].Select(c => new [] { c });
        if (cs.Skip(1).Any())
        {
            result =
                from xs in result
                from ys in permutate(cs.Skip(1))
                select xs.Concat(ys);
        }
    }
    return result;
};

```

That's it.

You can use it like this:

```
var digits = "(08) 8234-5678"
    .Where(x => char.IsDigit(x));

var results =
    permutate(digits)
        .Select(x => new string(x.ToArray()));

```

The result is a list of strings where each string is a permutation of the input number.

If you don't want to map digits to digits, just take them out of the original dictionary definition, but you must keep a single character for the digit `1` for it to work.

Let me know if this works for you.
Here's Javaish pseudo-codeish recursive function:

```
void recWords(String number, int ind, String buf, Collection<String> result){
  if(ind==number.length()) {
    result.add(buf);
  } else {
    for(char letter : lettersForNumber(number.charAt(ind)) {
      recWords(number, ind+1, buf+letter, result);
    }
  }
}

```

Further excercises after writing above as C# and adapting it to your code:

1. Change `buf` from `String` to one shared `StringBuilder`.
2. Then wrap this into class and pass only ind in recursion, have the others as class
member variables.
3. Then finally turn recursion into loop (hint: 3 nested loops, one of the inner loops will have increasing number of iterations).

Note about non-recursive version I'm thinking: It will be less efficient than recursion, but what makes it interesting and worthy of coding as an exercise is, it will be [breadth-first](http://en.wikipedia.org/wiki/Breadth-first_search), while this recursive version is [depth-first](http://en.wikipedia.org/wiki/Depth-first_search).