Rails, like many communities, has developed its own language. You need to know a lot of that language to understand what other people are saying, even when those people are trying to be helpful. This glossary gives you a quick guide to some common terms used in Rails that aren’t obvious to outsiders and provides the extra Rails meanings for words used elsewhere that have acquired additional meaning in Rails. Hopefully this will make it easier for you to understand Rails documentation and conversation, but of course, new terms will emerge over time:
This excerpt is from Learning Rails . Most Rails books are written for programmers looking for information on data structures. Learning Rails targets web developers whose programming experience is tied directly to the Web. Rather than begin with the inner layers of a Rails web application -- the models and controllers -- this unique book approaches Rails development from the outer layer: the application interface. You can start from the foundations of web design you already know, and then move more deeply into Ruby, objects, and database structures.
Atomicity, Consistency, Isolation, Durability. A set of principles, usually implemented with relational databases and transactions, that are intended to ensure data reliability. Rails is not designed with ACID as a priority, though transactions are available as a plug-in. (In a different meaning, there are also a variety of “Acid” tests for CSS implementation conformance.)
The part of the Rails library that directly interacts with incoming HTTP requests, including routing, parameter passing, session management, and deciding how to render a response. Controller objects are the main way in which Rails developers interact with ActionController.
Often used to describe collecting RSS or Atom syndication feeds, but has another meaning in Rails.
Aggregation lets you create simpler ways to access combinations of
data using the
method. You might do this to combine first and last names, or
address parts, or other pieces that can be broken down but that
are often conveniently used together.
In Rails parlance, assets are information outside of your application and its database—images are a classic example—that are incorporated by reference. Assets don’t need to be entirely outside of the application, however. Chapter 8, Improving Forms shows how to have Rails manage the arrival of image assets.
Attributes are information about an ActiveRecord model class, such as what fields it contains, what types they hold, and so on. Usually, Rails figures out what the attributes are directly from the application database, which knows what they are because they were set by migrations.
A collaboration tool (http://www.basecamphq.com/) developed by 37signals and DHH. DHH realized while building Basecamp that the underlying framework could be reused for a lot of other projects, and that became the foundation of Rails.
Code used to determine and compare performance. Generic benchmarks used to test things like CPU performance are the most common usage, but you could create your own benchmarks to test performance specific to your application.
Logic that is specific to a given application, and often specific to a given business. They specify rules for data that go beyond the computer-specific “This variable must be a string” to more complex rules like, “This date must be no earlier than x and no later than y” or “All expense reports must come with explicit and authenticated approval before consideration for payment.”
Rails does not do CamelCase, except in class names. CamelCase uses uppercase letters to identify
the beginnings of new words. Rails more typically keeps everything
lowercase, using underscores (
_ ) to separate the words.
In HTTP requests (and network requests generally), content types are used to identify the kind of content being sent. Content types are often called MIME types, from their original development as Multipurpose Internet Main Extensions.
A small (typically less than 4 kilobytes) chunk of text that is stored in a user’s browser and sent to the server that created it along with requests. Cookies can be used to track users across multiple requests, making it much simpler to maintain state across requests. In general, however, you should never store any significant information in cookies.
A Unix approach to scheduling tasks that need to run on a regular basis. “Cron jobs” are managed through the crontab configuration file, and the cron daemon makes sure they get executed as requested. (Rails itself doesn’t use cron, but you could use cron to manage periodic background housekeeping on a server, for instance.)
Cascading Style Sheets, a vocabulary for specifying how
precisely web pages should be displayed on screen,
in print, or in other media. In a Rails application, a CSS
stylesheet is typically an extra file or files kept in the
referenced from each view that uses it.
Not the American pharmacy/convenience store, but the Concurrent Versioning System, used to manage different versions of programs and related files. In Rails, CVS has typically been replaced by Subversion or Git.
David Heinemeier Hansson, the creator of Rails and its lead developer. For more DHH, see his blog, http://www.loudthinking.com/.
“If it walks like a duck and quacks like a duck, it’s a duck.” A way of determining what type an object has by looking at what it contains and how it behaves, rather than by looking for an explicit label on it. Duck typing is built into the Ruby language.
See duck typing, described earlier.
The latest and (sometimes) greatest version of Rails, Edge Rails lets you develop with the most recent updates to the framework. Exciting for advanced developers, but potentially explosive for beginners. (Note that you can freeze Rails versions if one goes by that you really liked or, worse, a new one appeared that broke your code.)
An implementation of ERb that is both faster and offers several extensions to ERb. For more information, see http://www.kuwata-lab.com/erubis/. You can use Erubis with or without Rails.
Data created for the explicit purpose of using it to
test your Rails applications. Fixtures are specified
in YAML and provide a customizable set of data you can use to
check the functionality of your Rails code. They are stored in the
While you can include Adobe Flash content as external assets in your Rails
flash in a Rails
context more frequently refers to a method for passing objects
between actions. You can set a message in the controller using
flash and then retrieve and
display that message in a view, for example.
A class containing methods for creating HTML forms. Form builders are typically used to create consistent-looking interfaces across an application and to present complex aspects of your models that need additional interface support.
Locking your Rails application down so that it runs on a particular version of Rails, no matter what version of Rails you install on your computer more generally. For production applications, this provides a much more reliable running environment. You freeze and unfreeze through the Rake tool.
as it is called from the command line, is a program you can use to
have Rails create a wide variety of different types of code for
you. In general, when creating new functionality, you should let
Rails generate much of the code and then customize it, rather than
writing from scratch.
The most commonly used HTML request, which has the general meaning of “retrieve content from the specified URL.” GET requests are supposed to be idempotent and, despite the availability of query parameters, should not be used to change information in an application.
Provides support for commonly performed operations in view code. Helpers are a little less formal than form builders, which typically have more understanding of the context in which they work. Rails provides a wide variety of helper methods for common tasks like generating HTML, and you can add your own helper methods as well.
HyperText Transfer Protocol, along with HTML, is the foundation on which the Web is built. HTTP supports requests that include a verb (like GET, POST, PUT, or DELETE) along with a variety of supporting information. Those requests are then answered by a responding server, which reports a [Response Code] and hopefully some information useful to whoever initiated the request. HTTP is itself built on top of TCP/IP, typically using port 80 to receive requests.
Like HTTP, but encrypted. Technically, the HyperText Transfer Protocol over Secure Socket Layer. HTTPS works much like HTTP, except that the web server adds a layer of encryption using public key certificates, it runs on port 443, and browsers are typically much more cautious about caching information that arrived over HTTPS.
An identifying value. In Rails, usually the primary key from a table of data, used for quick access to a particular row or object. In HTML, a unique identifier for one element in a document, often used for styling.
Internet Relay Chat, a key part of the communications that hold the Rails community together. You can find a lot more information on Rails and IRC, including servers, channels, and clients, at http://wiki.rubyonrails.org/rails/pages/IRC.
Code that handles the interactions between Rails and a database. Models contain data validation code—code that combines or fragments information to meet user or database expectations—and pretty much anything else you need to say about the data itself. However, models do not contain information about the actual structure or schema of the data they manage—that is kept in the database itself, managed by migrations.
A Ruby-based web server now used as the default server for Rails applications when run from the command line. In production, a “pack of mongrels” often runs behind an Apache web server, connecting HTTP requests to Rails.
Model-View-Controller, an architecture for building interactive applications that lies at the heart of the Rails framework. (See Chapter 3, Adding Web Style for a lot more information.)
The glue that holds Rails together, letting applications figure out which pieces connect to which pieces without requiring a formal mapping table. Rails makes naming conventions feel more natural by supporting features like pluralization.
Object-Relational Mapping, the hard part of getting object-oriented languages and relational databases to work together. Rails addresses this using ActiveRecord and makes it (mostly) transparent through naming conventions.
A piece of view code designed to produce part of a
document. Multiple views can then reference the
partial so that they don’t have to repeat the logic it already
contains. Partial names are prefixed with
An Apache module, also called mod_rails, for deploying Rails applications behind an Apache web server.
A feature of ActiveRecord that generates much controversy. Models have singular names, like person, while views and controllers use plurals of those names, because they work with many instances of the models. Rails has a set of defaults that handle both standard English pluralization and some common irregulars, like person and people, child and children. There are cases where pluralization doesn’t work in English, but fortunately they rarely affect programming.
An HTTP method that sends information to a given URI. POST is mapped to CREATE in REST-based Rails applications, though POST has been used as a general “send-this-stuff-over-there-via-HTTP” method in the past.
A more powerful but somewhat more daunting open source database that is frequently used by developers who want more control than MySQL provides, or access to specific extensions, like the geographic data work in PostGIS.
The Pragmatic Programmers, Dave Thomas and Andy Hunt, and their publishing company (http://www.pragprog.com/). They’ve written and published a wide variety of books on Ruby and Rails, and run related training courses.
Proxy servers (or proxies) receive requests on one end and then resubmit them to other servers. Proxies can be used to manage performance, to provide caching, to hide servers from users (and vice versa), for filtering, or for pretty much anything you want to do with an HTTP request between the request and the response.
A technique used by several browsers to support web pages formatted with older (broken) browsers in mind, while still allowing developers to specify that their pages should be processed using newer and generally more correct standards.
A conference focused on Rails, usually once a year in North America and once a year in Europe. For more information, see http://railsconf.com/.
A command-line tool that originally was Ruby’s replacement for the make build tool commonly used by Unix applications. Thanks to its scriptable extensibility, it has turned into a one-stop toolkit for applying migrations to databases, checking up on routes, freezing and unfreezing the version of Rails used by a given application, and many more tasks.
To convert data from one form to another, usually to present it. Web browsers render HTML into readable pages, while Rails views render data from Rails into HTML that gets sent to users’ web browsers.
For Rails development purposes, it’s probably easiest to think of a resource as code identified by a URI (or URL). It’s the code that will get called once Rails routing has examined the request and decided where to send it. (Outside of Rails, it can be a deeply philosophical notion at the heart of web architecture and infinite debates about web architecture.)
In HTTP, a response is a message sent from a server to a client in response to a request. It generally includes a status code as well as headers describing the kind of response, and data to present the client.
Not a vacation. Technically, “Representational State Transfer,” but really just a sane way to handle interactions on the Web in a way that takes full advantage of the underlying web architecture instead of chucking it and building something entirely different. Rails 2.0 includes a lot of features designed to make building REST-based applications easier. (See Chapter 5, Accelerating Development with Scaffolding and REST for a lot more detail.)
An acronym of various meanings that refers to several different XML formats for syndicating information from one site (typically weblogs, but also newspapers, periodicals, and others of sites) to clients and other servers that might be interested.
A site (http://rubyforge.org) that hosts a wide variety of open source Ruby software projects in development. You can use it as a place to share code you write or to find code others have already created.
Code that gets you started, much as scaffolding on
a construction project lets workers get to the parts
of a building they need to modify. Rails can
generate scaffolding code for a wide variety
of different project needs, though in Rails 2.0 scaffolding most frequently refers
to the REST-based set of models, views, and controllers created by
Originally the Simple Object Access Protocol, it proved not very simple, not necessarily bound to objects, and not exactly a protocol. SOAP is the foundation of most web services applications that don’t use REST, taking a very different approach to communications between applications.
The Structured Query Language is a common foundation used by databases to create and destroy structures for holding data, and to place and retrieve data inside of them. While SQL is extremely useful, Rails actually hides most SQL interactions so that developers can work with Ruby objects only, rather than having to think in both Ruby and SQL.
A simple database that stores its information in a
single file. (In Rails, that file is kept in the
db directory.) SQLite is
extremely convenient for initial development, but slows down
dramatically as the number of users grows.
A program used to manage different versions of programs and related files across many computers and developers. Many developers building Rails applications use Subversion, but the Rails code itself is now managed in Git.
Ruby identifiers prefaced with colons that Rails uses for pretty much every variable that gets passed from model to view to controller, as well as for named parameters. Symbols look and behave like variables for most ordinary programming purposes, but they give Rails tremendous flexibility.
Code designed to put a particular application piece through its paces. Rails comes complete with support for creating your own unit tests (does a model behave predictably?), functional tests (does a method do what it should?), integration tests (do these methods work together?). You can also create performance tests (how fast does this go, anyway?), and use stubs and mock objects to isolate components for testing.
If you came to Rails from Java or a similar language, you may be looking around for threads. Ruby has threads after all—why doesn’t Rails? Well, Rails is single-threaded, handling requests in a single thread. There are lots of ways around this, including having multiple instances of Rails servers all accessing the same database.
Universal Description, Discovery, and Integration, a supposedly magical but now largely forgotten piece of the web services picture. It was designed to help developers and programmers find SOAP-based web services.
The industry-standard way to identify characters. Originally, Unicode mapped one character to each of 65,535 bytes, but as that space filled, it became clear that things were more complicated. Ruby’s Unicode support improved substantially in version 1.9, but most things will work fine in 1.8.6.
Uniform Resource Identifier, a slightly polished up and abstracted version of the old URL that can be used to identify all kinds of things, no longer bound to a few protocols. In REST-based Rails applications, URIs connect to applications in a generally unsurprising way.
Uniform Resource Locator, the identifers that hold together the web. URLs specify a scheme (like http, ftp, or mailto) that maps to a particular protocol, and the rest of the URL provides information that, used with software supporting the scheme, gets you to the information the URL points to. (Or, if the information is gone, an error message.)
Coordinated Universal Time, formerly known as Greenwich Mean Time (GMT) or Zulu Time. Time zones are generally expressed as offsets from UTC. (UTC is a “compromise abbreviation” between English and French.)
A common encoding for Unicode characters. Old ASCII files are naturally UTF-8 compliant, but characters outside the ASCII range are encoded into multibyte representations. UTF-16 uses two bytes for most commonly used Unicode characters (on the Basic Multilingual Plane) and encodes characters outside of that range into multibyte sequences.
Checking that something is what it’s supposed to be. In Rails, data validation should be performed in the model, though some checks may also be performed in view code—for example, in Ajax applications that do as much on the client as possible.
The aspect of a Rails program that presents data and opportunities for interaction to users, whether those are users of web browsers getting HTML or other programs using XML or JSON or something else entirely.
What happens when the world finally “gets” the Web instead of treating it as a place to present brochures and catalogs, recognizing that the interactions among millions of people are creating new and (often) useful things.
A generic term for people who build applications or sites for the Web. Also, a Firefox plug-in that makes it easy to inspect various aspects of client-side website functionality as well as turn them on or off.
Using the Web for program-to-program communication, rather than the classic model of a human at a web browser interacting with a server. Web services development has largely bifurcated into SOAP-based (or WS-*) development and REST development. Rails 2.0 took a decisive shift toward REST, though you can still write SOAP web services in Rails if you want to.
The Web Services Description Language, used most frequently by SOAP-based (or WS-*) web service developers, provides a way of describing a web service that programs and humans can use to develop code for interacting with it.
that delivered the page, using the full set of verbs in the HTTP
protocol. It is supported by all of the major graphical web
browsers, though implementation details are only recently becoming
consistent across implementations.
XMLHttpRequest is at the heart of
Cross-site scripting is a security hazard that allows
crackers to interfere with your program’s logic by
inserting their own logic into your HTML. The main means of
ensuring that your applications don’t encounter it is to treat
content that might have originated from outside of your immediate
control as hostile, accepting as little HTML as your application’s
needs can tolerate. The
method makes it generally easy to escape any HTML that does come
Yet Another Markup Language, YAML was originally developed as a more programming-centric alternative to XML. Ruby supports YAML for object persistence. Rails uses YAML for configuration information. (And as it turns out, largely by coincidence, JSON is a subset of YAML.)
A sometimes mind-boggling Ruby feature that lets methods take a block of code along with the rest of
their parameters and then call that code with
yield when needed. Among other things,
this is how Rails implements the relationship between views and
If you enjoyed this excerpt, buy a copy of Learning Rails .
Copyright © 2009 O'Reilly Media, Inc.