Chapter 17. Ten Ways to Override Rails Defaults

In This Chapter

  • Circumventing the Rails naming conventions

  • Using alternative page layouts

  • Moving away from the development environment

The phrase “legacy database” is a euphemism for “an old database that's difficult to connect to modern software,” and for “a database that someone forces you to use.”

Consider the following scenario. You have a database that someone created several years ago, before Rails was invented. Table names, primary keys, and many other aspects of the old database don't follow the Rails standard naming conventions. What can you do about it? Here are some alternatives:

  • Modify the old database so that the database uses Rails conventions.

    This alternative involves another euphemism. The phrase “modifying an old database” actually means “asking for trouble.”

  • Forget about Rails. Instead, use legacy software to access the legacy database.

    Sure. And ten years from now, you think about replacing the Commodore 64 that you bought in 1982. No! Wait! Maybe someone still writes software updates for the Commodore 64.

  • Use Rails and override some Rails conventions so that Rails accesses the legacy database.

    That's a good choice.

Strangely enough, I need to establish some of my own conventions for this chapter's examples.

  • In each example, I assume that you start with a new Rails project.

    You can combine two or more of this chapter's tricks into one project. But if you're not careful about combining tricks, you can easily become confused. ...

Get Ruby on Rails For Dummies® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.