This is my #learning-story.
I started with the The Ruby on Rails Tutorial by Michael Hartl (http://ruby.railstutorial.org/ruby-on-rails-tutorial-book). This tutorial in general is fantastic, really really awesome. My favorite part is how complete it is. Michael walks you through every little detail of setting up your environment and links to lots of other useful resources.
As I went through the tutorial, though, I ended up pulling up a lot of other resources. Below is an adapted version of my notes as I worked through the tutorial. It took me about two months to work through the tutorial. I was only working on it intermittently but it still took longer than I was expecting.
I started with the The Ruby on Rails Tutorial by Michael Hartl (http://ruby.railstutorial.org/ruby-on-rails-tutorial-book). This tutorial in general is fantastic, really really awesome. My favorite part is how complete it is. Michael walks you through every little detail of setting up your environment and links to lots of other useful resources.
As I went through the tutorial, though, I ended up pulling up a lot of other resources. Below is an adapted version of my notes as I worked through the tutorial. It took me about two months to work through the tutorial. I was only working on it intermittently but it still took longer than I was expecting.
What the heck is REST?
The Rails Framework is deeply opinionated about being RESTful. This was embarrassing because I thought I knew what that meant but had to do some research before I really grokked it.The key thing about REST is that the URI is the noun and the standard HTTP methods are the verbs. (" If your URLs have action words in them, you're doing it wrong.") ... http://blog.steveklabnik.com/posts/2011-07-03-nobody-understands-rest-or-http
Walked through this tutorial on the underlying Ruby language: http://tryruby.org
Using git
Git reference book : http://git-scm.com/book First time setup of repository
$ git init
[tailor .gitignore file]
$ git add .
$ git status >> optional: checks the status
$ git commit -m "Initial commit"
Setting up remote stuff
General git reference: http://gitref.org/remotes/
$ git remote -v >> list configured remotes
$ git remote add origin https://github.com/hankish/repository.git >> sets up the remote (origin can be anything, repository should be the name of the configured repository on github)
$ git push -u origin master >> after one call to this you can just call "git push"
$ git remote rm origin >> removes remote
$ git remote rename origin newOrigin >> rename remote
Branching
$ git checkout -b new-branch-name >> creates a new branch (leaving out -b just switches branches)
$ git branch >> shows all branches with a star next to the active one[make your changes]
$ git status >> checks the status
$ git commit -a -m "message" >> commits all changes to EXISTING files
or... $ git add . >> to add files, then >> $ git commit -a -m "message" >> to commit
$ git co master >> checkout master
$ git merge new-branch-name >> merges the new branch into master
$ git branch -d new-branch-name >> gets rid of the new branch (use capital -D to remove without merging first)>> to move a file without it counting as a deletion use "git mv file.rb newfile.rb"
Deploying to heroku
[first make sure you've added postgresql gem >> gem 'pg']
$ heroku login
$ heroku create "hrt-testapp" >> creates a subdomain for "http://hrt-testapp.herokuapp.com" (you can leave the name off to get an auto generated one), also adds "heroku" as a remote to git
$ git push heroku master >> pushes the master branch to the active app
$ heroku open >> opens the active app in a web browser
$ heroku rename railstutorial >> optional: rename your app
$ heroku logs >> if you have problems this opens the deployment logs
Restoring a project from github (When switching development machines)
$ git fetch origin >> still not sure what this does but it's important
$ git fetch origin master
$ git co -b cur-github origin/master >> checks out the master branch from github and saves it in a branch called "cur-github"
$ git co master >> switch back to master
$ git merge cur-github >> merges into master
$ git branch -d cur-github >> removes the github branch
$ bundle install --without production >> installs any missing gems
Other miscellaneous links
- ruby language reference >> ruby api >> http://ruby-doc.org/core-1.9.3/
- symbols >> note about how they are different from strings : http://www.robertsosinski.com/2009/01/11/the-difference-between-ruby-symbols-and-strings/
- Link "Class and Instance Variables in Ruby" >> http://www.railstips.org/blog/archives/2006/11/18/class-and-instance-variables-in-ruby/
- More about asset pipeline >> http://guides.rubyonrails.org/asset_pipeline.html
- Bootstrap by default uses LESS, not sass. But they are very similar >> http://bootstrapdocs.com/v2.0.4/docs/less.html
- "Rails Routing from the Outside In" >> http://guides.rubyonrails.org/routing.html >> This is incredibly useful and I've referred to it frequently.
- Tool that's helpful for building ruby regex >> http://www.rubular.com/
- info on callbacks >> http://api.rubyonrails.org/v4.0.0/classes/ActiveRecord/Callbacks.html
- "bcrypt" can be used to do the hashing for password_digest >> http://en.wikipedia.org/wiki/Bcrypt
- Full text search on Heroku: https://devcenter.heroku.com/articles/full-text-search