Skip to content

Instantly share code, notes, and snippets.

View sobopla's full-sized avatar

Catherine J sobopla

  • Texas
View GitHub Profile

Alex's Rails Cheat Sheet

I think the most confusing thing that I have found about Ruby on Rails so far has been the transition from (trying to) write code myself to the use of the fabled "Rails Magic". So, to help my own understanding of a few core Ruby on Rails concepts, I have decided to write something on what I think is a CRITICAL topic... the idea of Convention over Configuration and why (in my mind) it is the most important thing that helps Rails become magic!

(This may be a topic that we cover in more detail in class but as I said, I'm writing this for my own understanding... I hope it helps someone else understand things too... Perhaps you can give me a hand when I'm crying next week!)

##Convention over configuration ###What does this "actually" mean...

motorbike = {
max_speed: 100,
color: :red,
number_of_wheels: 2,
current_speed: 0,
current_heading: 0,
engine_running: false,
odometer: 0
}
@sobopla
sobopla / cj_vampire.rb
Created April 27, 2017 02:52 — forked from gmmowry/cj_vampire.rb
CJ's vampire with comments from Glenna
# build the driver to get the class arguments to pass into initialize
#takes in arguments to flesh out the instance.
#1.collect values from user
#2.call methods to evaluate at the beginning of vampire evaluate method
#to be better in line with best practice
class VampireIntake
attr_accessor :age, :name, :year_born, :allergy, :vampire, :insurance, :garlic, :allergies
# I would rename your return variables for your evaluation methods so they are not named the exact same as your instance variables
require 'rails_helper'
RSpec.describe TodosController, :type => :controller do
context "GET index" do
#context "POST create" do
#context "GET show" do
#context "PATCH update" do (or PUT update)
#context "DELETE destroy" do
#context "GET new" do