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'm too lazy to write any code at the moment, but you should definitely be able to do this via recursion instead of seven nested loops, and in fact you should be able to design a method that should work on any arbitrary-length telephone number.

The basic idea is that you would design a recursive method something like this:

```
void recurse(String phone, int index, StringBuilder sb)
{
   // Get the number at position phone[index]
   // Loop through the possible letters for that particular number (eg. A, B, C):
      // Add the letter to the StringBuilder
      // Call recurse(phone, index + 1, sb)
      // Subtract last letter from the StringBuilder
}

```

Each time you recurse you are working on the next number / letter position.

Of course if you run into the terminating condition (sb length == phone length), then instead of recursing you just write the current value of the StringBuilder to file and return.

Hope this helps.

Edit: Getting around to actually writing some code. It's really this simple, no LINQ required:

```
   class Program
   {
      static Dictionary<Char, String> DigitMap = new Dictionary<Char, String>()
      {
         {'0', "0"},
         {'1', "1"},
         {'2', "ABC"},
         {'3', "DEF"},
         {'4', "GHI"},
         {'5', "JKL"},
         {'6', "MNO"},
         {'7', "PQRS"},
         {'8', "TUV"},
         {'9', "WXYZ"}
      };

      static void Main(string[] args)
      {
         String phone = Regex.Replace("867-5309", "[^0-9]", "");
         recurse(phone, 0, new StringBuilder());
      }

      static void recurse(String phone, int index, StringBuilder sb)
      {
         // Terminating condition
         if (index == phone.Length)
         {
            Console.WriteLine(sb.ToString());
            return;
         }

         // Get digit and letters string
         Char digit = phone[index];
         String letters = DigitMap[digit];

         // Loop through all letter combinations for digit
         foreach (Char c in letters)
         {
            sb.Append(c);
            recurse(phone, index + 1, sb);
            sb.Length -= 1;
         }
      }
   }
}

```

In this code (where I made a simple console app) I'm just writing the words to the console but you could be adding the strings to an array or writing them to disk instead.
I am sorry everyone. This was my first Stack Overflow post and I was expecting an email when an answer was posted to my question but never got one. I just figured that my question was swallowed into the abyss of stack overflow. 

A group of developers i work with got this one figured out in about 5 lines. I cannot seem to find the solution at the moment but I think it was very close to what Enigmativity posted. I am positive we used permutations. I will look for the solution we used. Thanks everyone.