I learned to code by reading lots of books, writing lots of code and getting involved in a local user group.
If you want to learn Ruby and Rails a couple of good resources are Learn to program by Chris Pine (an intro to ruby) and the rails tutorial by Michael Hartl http://ruby.railstutorial.org/ruby-on-rails-tutorial-book
Some other books I would recommend: - Practical object oriented design in ruby - Computer science programming basics in ruby - Agile web development with ruby on rails 4 - Eloquent ruby - Design patterns in ruby
If you get on the http://oreilly.com email list they regularly have 50% off ebook sales.