Commit 73e3a7d1 authored by Horatiu Halmaghi's avatar Horatiu Halmaghi

Removes breakout content, moved to breakout-05-16-2016 branch

parent 3a81fa16
......@@ -3,12 +3,3 @@ get '/' do
erb :index
end
get '/songs' do
@songs = Song.all
erb :songs
end
get '/albums' do
@albums = Album.all
erb :albums
end
class Album < ActiveRecord::Base
has_many :songs
end
class Song < ActiveRecord::Base
belongs_to :album
end
<h1>
Albums
</h1>
<ul>
<% @albums.each do |album| %>
<li> <%= album.title %> </li>
<% end %>
</ul>
......@@ -18,10 +18,7 @@
<title></title>
</head>
<body>
<nav>
<li>Nav item 1</li>
<li>Nav item 2</li>
</nav>
<%= yield %>
</body>
</html>
<h1>
Songs
</h1>
<ul>
<% @songs.each do |song| %>
<li> <%= song.name %>, <%= song.album.title %> </li>
<% end %>
</ul>
class Songs < ActiveRecord::Migration
def change
create_table :songs do |s|
s.string :name
s.string :artist
s.integer :likes
end
end
end
class Albums < ActiveRecord::Migration
def change
create_table :albums do |al|
al.string :title
al.string :record_label
al.date :release_date
end
end
end
class SongsForeignKey < ActiveRecord::Migration
def change
add_column :songs, :album_id, :integer
end
end
......@@ -11,19 +11,6 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20160516195607) do
create_table "albums", force: :cascade do |t|
t.string "title"
t.string "record_label"
t.date "release_date"
end
create_table "songs", force: :cascade do |t|
t.string "name"
t.string "artist"
t.integer "likes"
t.integer "album_id"
end
ActiveRecord::Schema.define(version: 0) do
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment