Skip to content

Instantly share code, notes, and snippets.

View StephenFiser's full-sized avatar

Stephen Fiser StephenFiser

View GitHub Profile
class Dog
def initialize(name, size)
@name = name
@size = size
end
def bark
"Ruff"
end
class Dog
attr_accessor :name
attr_reader :size, :color
def initialize(name, size, color)
@name = name
@size = size
@color = color
end
class Animal
attr_accessor :name
attr_reader :size, :color
def initialize(name, size, color)
@name = name
@size = size
@color = color
end
Rails.application.routes.draw do
resources :todos
# a bunch of commented out code ...
end
<h3>New Todo Item:</h3>
<%= render 'form' %>
<h5>All Todos</h5>
<table>
<thead>
<tr>
<th>Title</th>
<th colspan="3"></th>
</tr>
</thead>
class Todo < ActiveRecord::Base
def hours_since_created
((Time.now - created_at) / 1.hour).round
end
end
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3', group: :development
gem 'pg', group: :production
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
<h3>New Todo Item:</h3>
<%= render 'form' %>
<h5>All Todos</h5>
<table>
<thead>
<tr>
<th>Title</th>
<th colspan="3"></th>
</tr>
</thead>
> ralph.bark
> def ralph.bark
?> "Ruff!"
> end
> ralph.bark