Skip to content

Instantly share code, notes, and snippets.

View kcurbelo's full-sized avatar

Kevin kcurbelo

  • Los Angeles, California
View GitHub Profile
@kcurbelo
kcurbelo / Has_many.md
Last active November 26, 2024 22:33
Explaining a has_many :through association.

has_many :through


In this exercise we are going to explore the has_many through relationship by creating a quick example. The first part of this markdown will be geared toward making a simple example that shows the relationship while the second part will consist of expanding the simple app to show the relationships in the browser.

We are going to use doctors and patients for this example.

As you could have guessed a doctor can have many patients and a patient can have many doctors. One way that we could facilitate this many to many relationship is by using an "associative table". We can call our associative table "appointments", which should help us make it easier to understand the relationship between doctors and patient.

@kcurbelo
kcurbelo / Partials.md
Created February 18, 2015 18:13
Using partials to make your project DRY.

Partials


This markdown will be covering the basics of partials. Also known as “partial templates”, partials allow you to move the code for rendering a partial piece of a code into a separate file.

These are indicated by an underscore in front of the view file name, for example _form.html.erb

Lets say that we had this example code:

@kcurbelo
kcurbelo / Authentication.md
Last active August 29, 2015 14:15
An authentication example.

Authentication


This is a quick guide to get a very basic user login up and running.

First we will need to make a folder to work in. For the purposes of this guide I called mine "authentication" but you can call yours whatever you would like. Be sure to "cd" into this directory after you create it.

command line - $ mkdir authentication

command line - $ cd authentication