Erin Mulder on 16 Nov 2005 00:24:05 -0000 |
Last night, a couple of people wondered what you should actually do once you've downloaded and installed Ruby on Rails. For a quick exercise that can actually be turned into a useful application, check out this challenge on the Ruby on Rails site: http://www.phillyonrails.org/community/Challenges/2005/November/11 To get started with it, you need to: 1. Download and install Ruby (if you don't have it) 2. Download and install Rails (if you don't have it) 3. Download and install MySQL (if you don't have it) 4. Create a MySQL database with books, categories and books_categories tables 5. rails projectname 6. cd projectname 7. emacs config/database.yml # fill in the db settings and save 8. script/generate scaffold Book 9. script/server 10. Browse to http://localhost:3000/ to make sure server is running 11. Browse to http://localhost:3000/books 12. Have fun adding, editing and removing books At this point, you have a working app and just need to build on it until you complete the challenge. (To do that, you'll want to generate a scaffold for Category the same way you did for Book. Then, you need to create a has_and_belongs_to_many relationship between book and category (your mapping table is already there, so you just need one line of code in each model class to hook them up). Finally, you need to customize the views and add hyperlinks between them, so that when you're on a category, it links to all of the books in that category and vice versa.) Useful landmarks once you've generated your rails project: RAILS_PROJECT/config/database.yml - database settings RAILS_PROJECT/app/models - model classes for book and category RAILS_PROJECT/app/controllers - controller classes for book and category RAILS_PROJECT/app/views/books - RHTML files for book side RAILS_PROJECT/app/views/categories - RHTML files for category side RAILS_PROJECT/public/stylesheets - scaffold.css RAILS_PROJECT/script - generate and server scripts RAILS_PROJECT/log - development log Here's a neat cheatsheet: http://cwilliams.textdriven.com/files/rails_cheatsheet.gif if you're working on this and get stuck, feel free to email me (or the PhillyOnRails list) for help. I can walk you through the necessary code changes line by line. :) Cheers, Erin Michael C. Toren wrote: > A few items from the meeting last night: > > - Celestia, "the free space simulation that lets you explore our > universe in three dimensions", can be found at > http://www.shatters.net/celestia/. It's quite fun. > > - Selenium, a JavaScript QA tool for testing web applications in > Firefox, can be found at http://selenium.thoughtworks.com/ > > - Peter Seebach's Infrequently Asked Questions in comp.lang.c, lives > at http://www.plethora.net/~seebs/faqs/c-iaq.html. I particularly > enjoy the Arrays and Pointers section; the entire FAQ is probably > best enjoyed after reading the comp.lang.c FAQ, which is an > excellent reference. > > - ddclient, a Linux Dynamic DNS client, can be found at > http://ddclient.sf.net. I use it with the dyndns.com service, > although there are many others it is compatible with. > > -mct > _______________________________________________ bclug.org mailing list bclug.org@lists.sitelink.com http://lists.sitelink.com/mailman/listinfo/bclug.org This message was sent to historian@netisland.net
|
|