3-10 chapter  of http://railstutorial.ru/