Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
6 changes: 0 additions & 6 deletions config/database.yml.sample

This file was deleted.

3 changes: 3 additions & 0 deletions db/seed.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
Show.delete_all
amc = Network.create(name: "AMC")
nbc = Network.create(name: "NBC")
cbs = Network.create(name: "CBS")
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: "Person of Interest", day_of_week: "Thursday", hour_of_day: 20, network: cbs)
Show.create(name: "Criminal Minds", day_of_week: "Wednesday", hour_of_day: 20, network: cbs)
2 changes: 1 addition & 1 deletion models/show.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ class Show < ActiveRecord::Base
validates_presence_of :name

def to_s
"#{name} airs at #{hour_of_day}:#{day_of_week}:00 on #{network} "
"#{name} airs at #{hour_of_day}:00 on #{day_of_week}"
end
end
13 changes: 13 additions & 0 deletions watchman.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,16 @@
puts show
end
end

def find_show
dow = { 1 => "Monday", 2 => "Tuesday", 3 => "Wednesday", 4 => "Thursday", 5 => "Friday", 6 => "Saturday", 7 => "Sunday" }
puts "Pick a day of week: Use 1 for Monday ... 7 for Sunday"
user_pick = dow.fetch( gets.to_i ) { puts "sorry, not found" }

Network.all.each do |network|
network.shows.each { |show| puts show if show.day_of_week == user_pick }
end

end

find_show