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. 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. |
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 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 |
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 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 |
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
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 |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |