PHP Classes and Objects; Web Design using MVC
I’ve had some requests from students as to how we can implement the lecture’s PHP blog application in Rails. Well, here are the instructions (I’ll assume we’re using the Ubuntu 10.04 virtual machine with Rails 3 and RVM):
* first create a new Rails 3 project with rails new blog and change into the project directory.
* next, we use the scaffold generator to build views, controllers, models and database migrations via rails generate scaffold entry title:string content:text (the controller Rails creates will be named _entries_)
* now we can run our database migrations with rake db:migrate
* finally, we can run our Rails application with rails server (beware, you may need to specify a specific port here) and then point a local browser to http://localhost:3000/entries
You should now have a working and running Rails 3 application for the PHP blog application!
rails new blog
rails generate scaffold entry title:string content:text
Teaching materials for Relational Databases and Web Integration (CIS2360). Subscribe to module updates using RSS or email.
Ruby on Rails screencasts.