CSC/ECE 517 Fall 2011/ch2 2f mm

From Expertiza_Wiki
Revision as of 03:36, 21 September 2011 by Mrmanrin (talk | contribs)
Jump to navigation Jump to search

Introduction

Rails 2 vs. Rails 3

A lot changed in the update from Rails 2 to Rails 3. We will explore a few of the key areas that will affect a programmer's everyday coding.

Rails Application Scripts

When you create a new Rails application, a directory named script is generated. In Rails 2, this directory is populated with a set of scripts that can be executed by the programmer. A few of the more important ones are as follows:

  • generate: Used to generate code for controllers, mailers, models, scaffolds and other sets of code.
  • destroy: Used to destroy code created by the generate method.
  • server: Starts up the Rails application in a self-contained web server.
  • plugin: Helps with the installation and administration of plug-ins to the Rails framework.
  • performance directory: Contains scripts used by the programmer to help understand the performance characteristics of the application being built.

Rails 3 does away with all of these scripts and compiles them all into a single script named rails. With this script, the programmer can access all of the functionality that was available with the separate scripts. To make things even easier, the necessity to call this script outright is even unnecessary. By using the operating systems installed rails command (ie, /usr/bin/rails on Linux systems) in the root of any Rails 3 application, it will know to call this script.

References