Week 15: Lecture

PHP Classes and Objects; Web Design using MVC

Tags:

Week 15: Practical

PHP Classes and Objects; Web Design using MVC

Tags:

Comments


Carl Pulley said on Thursday, February 10, 2011:

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!