Posted By

jpowell on 05/25/07


Tagged

mysql database textmate rails scaffold basics


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

webstic
octoberborn


Database Model Controller Scaffolding Basics


 / Published in: Rails
 

  1. ====================================================
  2. DATABASE RELATED
  3. ====================================================
  4.  
  5. VERY BEGINNING MySQL DB BASICS
  6.  
  7. 1. Login to MySQL Monitor
  8. mysql -u root -p
  9.  
  10. 2. Create the database:
  11. create database store_development;
  12. create database store_test;
  13. create database store_production;
  14.  
  15. 3. Switch to this new database
  16. use store_development
  17.  
  18. 4. Create the table:
  19. create table items (
  20. id int not null auto_increment,
  21. name varchar(80) not null,
  22. description text not null,
  23. price decimal(8,2) not null,
  24. primary key(id)
  25. );
  26.  
  27. 5. Exit MySQL Monitor:
  28. exit
  29.  
  30. 6. Configure \config\database.yml accordingly
  31.  
  32. 7. Navigate to the directory of your Rails app (via Terminal)
  33.  
  34. 8. Create a model named Item and a controller named Managed this way:
  35. ruby script/generate scaffold Item Manage

Report this snippet  

You need to login to post a comment.