3.1. Introduction

Now that you have painstakingly read your way through Chapter 2, Ruby Basics and know a bit more what it's all about, we can move on to a more exciting bit. In this chapter, we will start our first Rails project and find our way into the topic step by step.
In this chapter, we will also move on the double in some cases. Once more, there will be some typical chicken and egg problems.

Environment (Development)

Rails knows three different environments:
  • Development
  • Test
  • Production
In this chapter, we are only working with the Development environment. Once you have gained a better feeling for Rails, we will start using tests and then we will need the corresponding environment (where, for example, the Test database is populated when you start a test and then cleared). Later, I will exlain the various scenarios to show how you can roll out your Rails application from the Development environment to the Production environment.
The Development environment has everything you need for developing, apart from an editor and a web browser. So you do not need to install a special web server, but can use the integrated Rails web server. It does not exactly have extremely high performance, but you do not need that for developing. Later, you can switch to big web servers like Apache. The same applies to the database.
In order to work in the Development environment, you do not need to make any changes to start with - all commands work by default.

SQLite-3 Database

In terms of the database, the main focus in this chapter is once more not on optimum performance, but on showing you a simple way of getting started. That's why we are using the SQLite-3 database. You already have everything you need fully installed and you don't need to worry about anything. Later I will explain how you can use other databases (for example MySQL).

Why Is It All in English?

If you are a native English speaker, you may not find it surprising that Rails apparently loves the English language. Yet it is almost a bit ironic, because its inventor David Heinemeier Hansson (DHH) originates from Denmark (he now lives and works in Chicago).
Even if you are not a native English speaker, you should try to accept and even adopt Rails' love for the English language. Much of it will then be much easier and more logical. Most of the code then reads just like a normal English sentence. For example, many mechanisms automagically use plural or singular forms of normal English words. If you get used to naming database fields and tables with English terms (even if you are programming in a different language), then you can make use of the whole power of this magic. This mechanism is referred to as Inflector [17] or Inflections (inflexions [18]).
If you are programming in a language other than English, it still makes sense to use English names for variables, classes and methods. You can write the comments in your own language, but if you take part in international projects, you should obviously write the comments in English as well. Yeah, sure … well written code does not need any comments. ;-)

Updates about this book will be published on my Twitter feed.