Ruby on Rails Wednesday, March 8, 2017

Hi, Pankaj!

I don't know whether you had web programming experience before, such as PHP or some others. As you know, Rails is a framework that helps in building Web applications. You type some words and punctuators into the 'address bar' in your browser, and get a page as response from server. What you typed is known as 'Internet address', part of which in form of '' is called 'domain' (not precisely). The other part after the domain name is what router handles with.

If you type '' in browser's address bar, the process of rails matches '/activerecord/associations' with the rules written in routes file. And rails chooses matched controller and method to tackle with data user sent, fetching data from database, render template, and finally returns a complete page to user. This is what router does. In the MVC model, this works in the Controller part.

Data associations is another important topic in web applications. Almost all user data are stored in databases, most of which are relational databases. A database consists of many tables. Just understand in this way:
- A rails application uses one database
- A database has many tables
- A table are mapped to a model
- A model describes some kind of entity, such as 'person', 'book' or 'user'
- Models are associated by associations, and there are many kinds of associations as listed in the rails guides page. For example, a person may have many books, but a book can only belong to one person. So this is a 'one to many' association. Rails makes abstraction of it, in order to write code like 'person.books.each { |book| xxx }'. More elegant and convenient.
- Association is usually talked in the model level. How is this actually implemented is not main issue we are interested in.

Both of routing and associations is related to many topics around web development and computer science. In order to know more about routing, you'd better learn how HTTP works and something about Rack. For associations, deep understanding of relational databases is helpful for using it well. Fortunately, rails did many for us. This is why so many people love it. Enjoy learning and using Rails!

Qiu Chaofan

在 2017年3月7日星期二 UTC+8上午4:01:04,pankaj kumarji写道:
I visited ''. I understood "Getting started with rails" but all other topics are useless. They do not make any sense because they are not enlisted series wise. Can any body help me out. I want to learn Rails step by step .Please help.

You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment