Web Programming

CSC 210, Spring 2011

(Monday and Wednesdays, 2:00-3:15pm in CSB 209)

Submit At my.rochester.edu

Assignment #8

This assignment tests your understanding of Ruby on Rails.

Assignment Contact

Your contact for this assignment is Kyle Murray. Please direct questions about this assignment to Kyle (see the Contact Page) because he will best know what's going on. You can also always contact Jeff, who will probably end up forwarding your question to Kyle.

Running Rails

Ruby (1.8.5) and Ruby on Rails (2.1.1) are already installed and configured on Betaweb. When creating your application, remember that we are using MySQL and not the default SQLite, so include the -d mysql option with rails. The file your_app_name/config/database.yml will need to be changed to work with your database account. Use the development database mode, and change the following parameters to match the account information that you were given along with your Betaweb login information:


    database: yourBetawebUsername
    username: yourBetawebUsername
    password: yourDatabasePasswordFromTheInitialEmail
  
Because many of your fellow students may be testing their own applications while you are testing your own, be sure to choose a unique port number on which to test your application (the server will fail to start if you do not, so just choose another one at that point).

A typical procedure for starting a Rails application on Betaweb looks like this:

  1. From your app's directory, run ruby script/server -p portNumber where portNumber is an integer of your choice that's above 1023.
  2. Visit http://betaweb.csug.rochester.edu:portNumber/ from a computer that is behind the URCS firewall. Such computers include those in the CS majors' lab, the Undergraduate Inner Lab on the 3rd floor of Hylan, and the various "cycle[n]" CSUG servers. X forwarding is a convenient way to access many of these systems.

Note:
If you choose to develop on your own machine, please be sure that you use versions of Ruby and Rails that are compatible with those installed on Betaweb; your submitted application will be tested on Betaweb. Take special care to notice that the current version of Rails (3.x) has numerous incompatibilities with the version that is on Betaweb, so it would probably be best to develop with the version of Rails that is on Betaweb. (For example, installing Rails through the gem command: gem install rails --version=2.1.1) There are instructions for installing Ruby and Rails on various operating systems on the course schedule page, on the date of the first Ruby on Rails lecture.

Assignment Requirements

Several top editors just left their jobs at Engadget. Fitting with their fast-paced lifestyles, they have already moved on to a new media company formed by the owners of the sports site SBNation. They have been promised wonderful publishing software to make their new gadget and technology site. Unfortunately, those promises were made without telling the web development staff. Never having experienced fast web development using a framework before, they all promptly resigned, leaving only YOU to develop the site in time for its launch in the near future.

Your task is to develop a gadget blog using Ruby on Rails. Because this is likely your first time using Rails and perhaps even Ruby, the requirements will not be as strict as they would be for a production site. However, by the end of this assignment you'll be tantalizingly close to being able to create the next popular tech news site.

Appearance Details

The index page of your site should consist of a site title/logo and a listing of all of the published blog posts. Each post should have a title, an author, and some content. The full article should not be displayed for posts on the main page. Instead, posts should be truncated to around 100 words; clicking on the post title should link to the full post. Make sure to credit the author with a link to the author's profile page on the site. Author pages should list the published posts by that author, along with a profile picture and some short biographical information.

An example blog homepage

Behavior Details

Both authors and blog posts should be able to created, edited, and deleted via a web interface. Rails' models and scaffolding are likely essential tools to accomplish this task. For the purposes of this assignment, it is not necessary to limit access to who can create, edit, or delete authors or blog posts via user accounts or anything of the sort.

The URLs for blog posts should be human readable. For example, example.com/posts/iphone-5-review is a readable URL that gives visitors and search engines an idea of the contents of the article before it is actually accessed. URLs can be automatically determined based on the title, or they can be chosen by the author of the post via the web creation/editing interface.

Blog posts (but not authors) must have a notion of being published. Published posts show up on the main page of the site and are accessible via their human-readable URLs. Unpublished posts are not viewable on the main and are not viewable via their human-readable URL. They are accessible through a special number that is related to their internal database record's ID. In our case, this number is simply the factorial of ID, so the first 5 posts would always be accessible via /posts/1, /posts/2, /posts/6, /posts/24, /posts/120. This mimics an internal hash or unique ID that might be used to restrict access to an unpublished post to those who have been explicitly given the link, but that is hard to forge. In our simpler case, the factorial sequence is actually fairly easy to compute so that you can still access all of your unpublished entries during the development process.

Grading and Turn-in

Due to the ephemeral nature of the Rails processes on Betaweb, the turn-in for this assignment will be a source code turn-in via Blackboard. Submit your code in a ZIP archive along with a README file describing what you accomplished in the assignment, how you implemented it, and a description of any completed extra credit.

Grading will be based on the appearance and behavior criteria outlined above, as well as on the appropriate use of the MVC pattern described in class and the slides, and as used extensively in Rails and by the Rails community at large.

Extra Credit

As usual, there are some extra credit opportunities this week. Make sure to include a description of the extra credit that you complete (if any) in the readme file that you turn in with your source code.

Props

This document's contents are © 2011 Kyle Murray and licensed under Creative Commons Attribution 2.5 License. It was developed at the University of Rochester for the Spring 2011 CSC 210 class.

Please email Jeffrey P. Bigham at jbigham@cs.rochester.edu with questions.

Valid XHTML 1.0 Transitional Valid CSS!