Rails does come handy, a rails generate scaffold command to generate all the files for view, controller, and model, and then execute rake db:migrate You can generate the corresponding database table structure. And this simple rake db:migrate has an unexpected problem:
Let's start with the background: rails When you create a project, the SQLite database is used by default. In order to get started quickly, I replaced the MySQL, also modified the corresponding configuration file CONFIG/DATABASE.YML.
First question:
Rake aborted!
Uninitialized constant RAKE:DSL
reason : The default installed rake version is too low and incompatible
solution : Upgrade Rake
Step : 1. Install the 0.9.2 version of Rake,gem install rake-version=0.9.2
2. Uninstall the original version (you can view the currently installed version via Gem-list rake), gem uninstall rake-version=0.8.7
3. Update all components, bundle update
4. Run Rake db:migrate. Then came the second question.
second question :
Rake aborted.
Mysql::error:query:not Connected:show TABLES
reason : MySQL5.1 LibmySQL.dll is incompatible with current rails
workaround : Replace with old version.
Step : 1. Download the old version of Libmysql.dll:http://instantrails.rubyforge.org/svn/trunk/instantrails-win/instantrails/mysql/bin/libmysql.dll
2. Put the downloaded file in the%ruby_home/bin directory.
Reference:
Http://stackoverflow.com/questions/6085610/rails-rake-problems-uninitialized-constant-rakedsl
http://rordiary.com/blog/tag/mysql/