title: Rails/Mysql/SQLite - What's the best idea for building 2- or 3-level menu
body: <p>I think about the best way, how to create a 2- 3-level menu. My first idea is everything to store to one database table, with the following structure:</p>
  
  <pre><code>- id
  - item
  - level
  </code></pre>
  
  <p>If I create the first-level menu item, so <strong>level</strong> will 0. If I will create the menu item of second level (eg. Contact - phone), so <strong>phone</strong> is the second menu item and the value of <strong>level</strong> will be the ID of Contact.
  But now - I don't know, how to print it from database - in the first loop I will print the first level of menu items (with level=0) and then I should to print the second menu items (with level=ID_of_first_menu_item) - exist any elegant way, how to simultaneously print first and second level items (I will build it in Rails)?</p>
  
  <p>And the second way - every level of menu items stored to separate table - but I mean this is not good idea...</p>
  
  <p>Thanks for your help!</p>