Skip to content

Instantly share code, notes, and snippets.

View calaway's full-sized avatar

Calaway calaway

View GitHub Profile

Migration with ActiveRecord and Rails

Basic CLI commands

1.) Create a new table

  • rails g migration CreateTask title:string description:text
class AddStartDateToTask < ActiveRecord::Migration
@case-eee
case-eee / resources.md
Created August 16, 2016 15:46
Module 2 Resources
@ryanflach
ryanflach / rails_setup.md
Last active November 13, 2023 19:49
Common setup for a new Rails project
  1. rails new <project_name> -d postgresql --skip-turbolinks --skip-spring -T
  • -d postgresql sets up the project to use PostgreSQL
  • --skip-turbolinks & --skip-spring creates a project that does not use turbolinks or spring
  • -T skips the creation of the test directory and use of Test::Unit
  1. In the Gemfile:
  • Available to all environments:
    • gem 'figaro' - store environment variables securely across your app (docs)
    • Uncomment gem 'bcrypt', '~> 3.1.7' if you will be hosting your own user accounts with passwords (docs)
  • Inside of group :test:
    • gem 'rspec-rails' - user rspec in place of minitest (docs)

Things For Review / Exploration

This is a guide to keep you busy over intermission. What you choose to do here will be highly dependant on what you need to review, ramp up on, or learn.

What should I do??

You don't HAVE to do any of this. You will not be graded, but most likely there are some things here you SHOULD do. I would suggest you do something over break to keep the rust off. At this point you are almost finished with Turing, and you should be a self-sustainable learner. That means you should be able to judge what you need to do. Here is what I would suggest:

  1. Redoing, or doing something much like the mid-mod is good practice for everyone.