How to use Rails Migrations - Part II
April 26th, 2007 by Yavor Ivanov

This article is part two of the series about Rails Migrations and it will explain on a deeper level how to use the Ruby on Rails migrations.
After we spoke about Migrations in our previous article found here we understood the basics needed to use Migrations in Ruby on Rails.
Now to begin with the code and something we did not mention earlier.
You see indexes are something that a good database design MUST contain!
This example shows how to add and remove an indexed field.
And now let’s take a look at some examples which might or might not be so obvious to make.
You like it? Digg it!
Developing a News site in Rails [Project 1] [Part 1]
April 22nd, 2007 by Yavor Ivanov
Recently I was asked the following question:
“How hard is it to build this project in Rails”
You can substitute this with anything. After a short period of time I realized that such a question can’t be really answered to a point where a programmer would agree completely if he/she didn’t even touched Ruby on Rails. In order to change that fact a person should see the whole process of developing and deploying a Rails application so he/she can realize the power and potential of a Rails application.
With all this in mind I hereby announce the Project type articles of RubyCorner.net. Those articles will represent an overview of the development process of a real working Rails web application. This article is the first of the series Project and it will begin not so briefly and give a more detailed overview of the things we will do. The next articles in the series will focus on more complex things and will skip those explained before assuming the knowledge was already obtained.
Let’s begin with our first web application project:
Project 1 – Developing a News site in Rails
parts count: 3 (this is a three day project)
Rails version used: 1.2.3 (used both on Windows and Linux platform)
Ruby version used: 1.8.5 (used both on Windows and Linux platform)
Knowledge of HTML and CSS: assumed
Knowledge of a Web Programming Language and Database: Basic-Advanced assumed
You like it? Digg it!
How to use Rails Migrations - Part I
March 19th, 2007 by Yavor Ivanov

This article is part one of the series about Rails Migrations and it will explain on a basic level how to use the Ruby on Rails migrations.
1. What are Migrations ?
Migrations in Rails is a way of describing what the database should look like and synchronize it with the respective model.
Migrations are abstract to the database they are used with. This means that if you have used a MySQL database server when developing the application and the production database server is different let’s say Postgresql the database you defined within the migrations will remain intact and will run just fine on the new database server.
Migrations provide a way to make the database development SVN like… I will cover this latter on so just keep in mind this for now.
2. Creating and Running Migrations
A migration is a simple Ruby file in the db/migrate directory.
Each migration file has a name starting with three digits and an
underscore. Those digits are the representation of the migrations version (a bit like SVN),
because they define the sequence in which the migrations are applied.
To generate a migration type:
Notice: This will generate a model and a migration to it.
You like it? Digg it!
Setup a Production Ready Ruby on Rails Application Over Apache and Mongrel
March 5th, 2007 by Stanislav BozhkovSetting up a Ruby on Rails Application in a production environment could be a bit tricky. This is because the standard servers for running ruby could serve only one request at a time. As a result if there’s a slow database connection or any other process away from the application server no other requests could be served. On contrast Apache httpd spawns a new child if there’s a necessity to process a new request. In this article I’ll guide you how to solve this problem. Generally there will be an apache httpd server which will be used as a gateway to a cluster of mongrel_rails processes. So, all users will be accessing the apache as a frontend, however the whole processing burden will be let down to the mongrel servers. Here it is an example:
First to mention, I’m making this setup on Fedora Core 6. However it should be almost the same on older versions or other distributions. Note: Your apache should support mod_proxy_balancer (it is distributed with apache 2.2.x). So, the basic software requirements are:
- Ruby - You won’t go without a ruby interpreter (preferably version 1.8.5). On a Fedora 2 I did a source “compile and install” without any complications
- ruby-devel package - In case that you’ve installed ruby as a package you should install ruby-devel in order to compile a few mongrel related gems
- gem - The tool to install most of the extensions which are related to ruby. If you want to install from sources (it’s pretty easy: ruby setup.rb) you can download it from here: gem sources
You like it? Digg it!
