Rails loop

You should definitely take some book in hands.
Pick any Rails related or start from the http://www.rubyonrails.org/docs,
and try to pass all tutorials.
All things will be mush clear.