Active Record tracks which migrations have already been run so all you have to do is update your source and run rake db:migrate. Active Record will work out which migrations should be run. It will also update your db/schema.rb file to match the structure of your database.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//------------------------------------------------------------------------------------------------------------------ | |
// YOUR CODE: Create your Zoo "object literal" and Animal "constructor" and "prototypes" here. | |
//------------------------------------------------------------------------------------------------------------------ | |
function Animal (name, length) { | |
this.name = name; | |
this.length = length; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css"> | |
<link rel="stylesheet" href="main.css"> | |
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800"> | |
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900"> | |
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css"> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class='container'> | |
<h1>Register</h1> | |
<form class='login' name='login' action='/user_create' method='post'> | |
<input type='text' name='first_name' placeholder='First Name'></input> | |
<input type='text' name='last_name' placeholder='Last Name'></input> | |
<input type='email' name='email' placeholder='Email'></input> | |
<input type='text' name='user_name' placeholder='Username'></input> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function () { | |
// PSEUDO-CODE: | |
// 1- intercept the form submission event using jQuery | |
// 2- prevent the default action for that event from happening | |
// 3- generate a random number between 1 and 6 using JavaScript | |
// 4- use jQuery to submit an AJAX post to the form's action | |
// 5- when the AJAX post is done, replace the contents of the "#die" DIV in the DOM using jQuery | |
$('form').on('submit', function(e){ | |
e.preventDefault(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class String | |
def to_bool | |
return true if self == true || self =~ (/(true|t|yes|y|1)$/i) | |
return false if self == false || self.blank? || self =~ (/(false|f|no|n|0)$/i) | |
raise ArgumentError.new("invalid value for Boolean: \"#{self}\"") | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. class Gear | |
2 attr_reader :chainring, :cog # <------- | |
3 def initialize(chainring, cog) | |
4 @chainring = chainring | |
5 @cog = cog | |
6 end | |
7 | |
8 def ratio | |
9 chainring / cog.to_f # <------- | |
10 end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GuessingGame | |
# this is just a crapshoot, doesn't seem to help or hinder | |
attr_accessor :solved | |
attr_accessor :answer_int | |
def initialize(answer_int) | |
@answer = answer_int | |
@solved = false | |
end |
Iron has profound effects on the human body. Too little and you'll be anemic, too much and you'll rust from the inside (hemochromatosis). By far the most common route to iron absorption is through ingestion.
Insoluble Fe3+ enters the GI tract, where it is almost entirely absorbed in the duodenum by enterocytes of the duodenal lining. Before it can be absorbed it must be reduced to Fe2+ by a ferric reductase enzyme on the brush border of the enterocytes. From here a divalent metal transporter protein then transports the iron across the enterocytes cell membrane and into the cell. This is the big step, the body now chooses to either store the iron as ferritin or ferroportin.
- If the iron is stored as ferritin--a globular protein that is the main intracellular iron storage protein that keeps the iron soluble and non-toxic--the iron will leave the body when the cell dies and is sloughed off into the feces. Ferroportin is a transmembrane protein that transports ir
NewerOlder