11.4. A Few Enterprise Pointers

Before letting you go and wrapping up this chapter, I'd like to provide you with a few pointers about "enterprise-y" topics that may interest you.

  • Because you can use the method establish_connection on a per model basis, it is possible to let Rails applications communicate with multiple databases. A starting point is the wiki article: http://wiki.rubyonrails.org/rails/pages/HowtoUseMultipleDatabases.

    Freeze Your Application

    One common deployment issue is having different Rails versions on your development machine and your production server. An easy way to guarantee that your code will work in production, no matter what version of Rails is installed, is to "freeze your application" by copying your local Rails version within the vendor\rails directory. This process is entirely automated by running rake rails:freeze:gems. The reverse action is rake rails:unfreeze, which will remove the local copy.

    Likewise, it is possible to freeze the non-Rails gems required by your application by running rake gems:unpack (or gems:unpack:dependencies to include the dependencies as well). These gems will be placed in the vendor\gems directory of your project.

    Once Rails and the required gems are frozen, you can deploy your application without worrying about mismatching versions.

  • To work with Legacy schemas you may have to overwrite some conventions via configuration. A good starting point is the previously mentioned wiki article: http://wiki.rubyonrails.org/rails/pages/howtouselegacyschemas ...

Get Ruby on Rails® for Microsoft Developers 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.