深入淺出RoR
- 2. Agenda
• About RoR
• MVC
• Implement a simple web post board
• Important source code
• Conclusion
- 3. About RoR
• Based on “Ruby Programming Language”
• A framework for “Agile Development”
- 5. Implement
• Before you start the implement, you have
to make sure your system environment is
readay!
• Ruby 1.8.6
• Rails > 2.2
• MySQL >5.0
- 7. 2. Select Database Type
>rails post -d <type>
mysql sqlite3 postgreSQL
Write the variables to
database.yml
- 8. 3. Configure a Database
~> cd post
post> nano config/database.yml
- 9. 4. Create database
> rake db:create
Connect to database
Check the result
Create successfully!
- 11. Test the Server
> script/server
http://127.0.0.1:3000/home/index
Text
Default Index
- 12. 6. Setting the Homepage
remove default index
Edit config/routes.rb
Add this argument
- 14. 8.Migrate
> rake db:migrate
Check the database
Tables of database
Fields in table
- 16. 10.Test
Post Successful
New Back to list
(show)
Database Status
Edit