Skip to content

Instantly share code, notes, and snippets.

View rwarbelow's full-sized avatar
💭
hungry

Rachel Warbelow rwarbelow

💭
hungry
  • Guild Education
  • Denver, CO
View GitHub Profile

Use what you know about Ruby, Rails, MVC, sessions, etc. to create the following pieces of functionality:

  1. A user who already exists in the database can log in using a username/password combination that they enter in a form. They should know that they are logged in because something like "Welcome, Rachel!" should appear at the top of every page they visit.

  2. A user who already exists in the database and is already logged in should be able to log out. They should know that they are logged out because their welcome message will no longer appear at the top of every page they visit.

  3. Users should have many jobs, and a job should belong to a user. Therefore, when a user visits any jobs listing, they should only see jobs associated with them. They should not be able to see, edit, or delete any jobs that are not associated with their account.

  4. A user who does not exist in the database should be able to create an account through a form that gathers any necessary user information. Once they create an a

Right now, your Job Tracker app is available to use by anyone. Wouldn't it be nice if we could make it so that only logged-in users could access the site?

Today, you'll attempt to implement authentication in your Job Tracker app. This challenge is not meant to give you step-by-step instructions for implementing authentication. Instead, you'll be prompted with places to start, things to cosider, and resources to reference, but you'll want to consider the implications of your choices along the way.

Before you start, read this article which talks about the difference between authentication and authorization. We'll focus most of this challenge on authentication, although you will see bits of authorization.

The purpose of the challenge is to figure out the moving pieces of authentication, not to TDD the authentication process. Therefore, don't worry about writing tests.

As you go through this challenge, push to try to get as many pieces figu

@rwarbelow
rwarbelow / mail_example.rb
Last active July 20, 2016 18:13
Mail Gem Example
require 'mail'
mail = Mail.new do
from 'rachelwarbelow@gmail.com'
to 'rachel@turing.io'
subject 'Hello!'
body 'This is an email that was sent using Ruby.'
end
mail.delivery_method :sendmail

Cross-Instructor Observation

  • Instructor:
  • Date:
  • Cohort:
  • Module:
  • Observed by:

Things to Watch

This file has been truncated, but you can view the full file.

Use a Schema Designer to create schemas for the following problems:

  1. City Library System
  • a user can check out books
  • books have one or more authors
  • books belong to a library branch
  • a book can be reserved by a user
  1. Movie Showtimes
  • a movie has many showtimes at various theaters
@rwarbelow
rwarbelow / sessions_cookies_flashes_homework.markdown
Last active August 25, 2016 15:07
Sessions, Cookies, and Flashes Homework

Homework

  1. Using a Flash

Implement a flash[:notice] in the ToolsController #create action for when you successfully create a tool. Extension: Modify your #create action to conditionally create a tool depending on whether or not a name is provided. Then create a flash[:error] that holds @tool.errors.full_messages.join(", "). Use a dynamic content generator to display the flash notice. Take a look at 20:33 in the Sessions, Cookies, and Flashes video for a refresher on how to do this.

  1. Storing Most Recent Tool in the Session
  • Store the id of the last tool added to ToolChest in the session with a key of :most_recent_tool_id.
  • Add a method to your ApplicationController called most_recent_tool that loads the most recent tool using :most_recent_tool_id stored in the session. (Hint: use Tool.find... and make sure it doesn't break if there are no tools in the database!)
@rwarbelow
rwarbelow / saving_energy_at_turing.md
Last active February 15, 2016 22:48
Saving Energy at Turing

Energy-Saving MacBook Tips

Customize Energy Saver Settings

  • Open System Preferences
  • Select "Energy Saver"
  • Move the "Turn display off after" slider to 10 min on both the Battery tab and the Power Adapter tab
  • Check "Put hard disks to sleep when possible" on both the Battery tab and the Power Adapter tab
  • Check "Slightly dim the display while on battery power"
@rwarbelow
rwarbelow / adding_categories_to_taskmanager.markdown
Last active February 5, 2016 07:31
Adding Categories to Task Manager

Adding Categories to Task Manager

First, delete both task_manager_development.sqlite3 and task_manager_test.sqlite3. Then make sure you have the following code in your migration file (001_create_tasks.rb):

require 'sequel'

environments = ["test", "development"]

environments.each do |env| 
@rwarbelow
rwarbelow / warmup_how_the_web_works.markdown
Created February 2, 2016 15:59
Warmup: How the Web Works