Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ GEM
i18n (0.6.0)
multi_json (1.3.4)
pg (0.13.2)
pg (0.13.2-x86-mingw32)
rake (0.9.2.2)
rspec (2.9.0)
rspec-core (~> 2.9.0)
Expand All @@ -31,6 +32,7 @@ GEM

PLATFORMS
ruby
x86-mingw32

DEPENDENCIES
activerecord
Expand Down
6 changes: 0 additions & 6 deletions config/database.yml.sample

This file was deleted.

4 changes: 4 additions & 0 deletions db/seed.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
Show.delete_all
amc = Network.create(name: "AMC")
nbc = Network.create(name: "NBC")
fox = Network.create(name: "FOX")
fx = Network.create(name: "FX")
Show.create(name: "Mad Men", day_of_week: "Sunday", hour_of_day: 22, network: amc)
Show.create(name: "Community", day_of_week: "Thursday", hour_of_day: 20, network: nbc)
Show.create(name: "Bones", day_of_week: "Monday", hour_of_day: 20, network: fox)
Show.create(name: "Archer", day_of_week: "Thursday", hour_of_day: 22, network: fx)
13 changes: 12 additions & 1 deletion watchman.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,21 @@
require "./db/seed"

puts "There are #{Show.count} in the database"

Network.all.each do |network|
puts "Shows airing on #{network}"
network.shows.each do |show|
puts show
end
end

puts "\nAll shows"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DId you find you needed to add the line break "\n"? Normally not needed

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It isn't necessary, but I thought it made the output easier to read.

Show.all.each do |show|
puts show
end

puts "\nWhat day do you want to watch a show?"
day = gets.chomp().capitalize
puts "\nShows on #{day}"
Show.all.each do |show|
puts show if show.day_of_week == day
end