Git Branching
##Local Branching
Use the Git branch command to create a new branch:
Serenity:blog_pg$ git branch
* master
Serenity:blog_pg$ git branch new_branch
Serenity:blog_pg$ git branch
* master
new_branch
Switch to the new branch:
Serenity:blog_pg$ git checkout new_branch
Switched to branch 'new_branch'
Serenity:blog_pg$ git branch
master
* new_branch
Or, create the branch and switch to it all in one go:
Serenity:blog_pg$ git checkout -b new_branch
Switched to a new branch 'new_branch'
Serenity:blog_pg$ git branch
m...
Passing multiple arguments to a view partial
##Problem
I want to use the same view partial to render the text fields and checkboxes for the new, edit, and show user pages. The fields and checkboxes need to be enabled on the new and edit pages and disabled on the show page. To make that happen, I want to pass the user object and an enabled/disabled boolean to the partial when it's time to render the elements. I found an answer at the Rails Forum website and, after some trial and error was able to make it work.
##Solution
**Create a view p...
Pagination
Update Gemfile
- Add pagination gems to general section at the top of the Gemfile.
source 'https://rubygems.org'
gem 'rails', '3.2.12'
gem 'bootstrap-sass', '2.3.0.1'
gem 'will_paginate', '3.0.4'
gem 'bootstrap-will_paginate', '0.0.9'
*
*
- Run bundle install
Note: You may have to run bundle update first if this is the first time you've used pagination.
Add pagination to the ApplicationController subclass
class UsersController < ApplicationController
*
*
def ...
Basic Git Setup and Use
Set Up Git
Note: This is a condensed version. For the full treatment, look here.
Now that you have Git installed, it's time to configure your settings. To do this you need to open the command line.
Username
First you need to tell git your name, so that it can properly label the commits you make.
git config --global user.name "Your Name Here"
# Sets the default name for git to use when you commit
Git saves your email address into the commits you make. We ...