Skip to content

Instantly share code, notes, and snippets.

View fdogarro's full-sized avatar

Felicia D O'Garro fdogarro

View GitHub Profile
// 1. Create a variable named show and assign it to the string "Stranger Things".
var museums = ["Met", "Lourve", "Uffizi", "Prado"];
// 2. Access the Lourve and Prado by index from the museums array
// and log to the console.
for(var i = 0; i < museums.length; i++){
// 3. List out all the museums by using console.log.
class RelationshipsController < ApplicationController
before_action :authenticate_user!
def create
@user = User.find(params[:relationship][:followed_id])
current_user.follow!(@user)
redirect_to user_path @user
end
class RelationshipsController < ApplicationController
before_action :authenticate_user!
def create
@user = User.find(params[:relationship][:followed_id])
current_user.follow!(@user)
redirect_to user_path @user
end
def following?(other_user)
self.relationships.find_by(followed_id: other_user.id)
end
def follow!(other_user)
self.relationships.create!(followed_id: other_user.id)
end
def unfollow!(other_user)
self.relationships.find_by(followed_id: other_user.id).destroy
@fdogarro
fdogarro / 0_reuse_code.js
Created January 31, 2014 15:00
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console