diff --git a/app/models/episode.rb b/app/models/episode.rb index 9f05fa4..520b64c 100644 --- a/app/models/episode.rb +++ b/app/models/episode.rb @@ -4,4 +4,5 @@ class Episode < ApplicationRecord validates :name, presence: true validates :number, presence: true, numericality: { greater_than_or_equal_to: 1 } validates :release_date, presence: true + validates :summary, presence: true end diff --git a/app/models/season.rb b/app/models/season.rb index 6979b0c..99ccbb7 100644 --- a/app/models/season.rb +++ b/app/models/season.rb @@ -1,5 +1,6 @@ class Season < ApplicationRecord belongs_to :series + has_many :episodes validates :name, presence: true validates :number, presence: true, numericality: { greater_than_or_equal_to: 1 } diff --git a/app/views/series/index.html.erb b/app/views/series/index.html.erb index f1dc7fb..b9dbd6c 100644 --- a/app/views/series/index.html.erb +++ b/app/views/series/index.html.erb @@ -39,7 +39,7 @@ <% end %>
- S07E07 + S0<%= s.seasons.first.number %>E0<%= s.seasons.first.episodes.first.number %>
<%= s.title %> diff --git a/app/views/series/show.html.erb b/app/views/series/show.html.erb index 90a939f..1af5ae4 100644 --- a/app/views/series/show.html.erb +++ b/app/views/series/show.html.erb @@ -16,9 +16,9 @@
- <%= image_tag "american-horror-story.jpg", width: "100%", height: "auto" %> + <%= image_tag @serie.image_path, width: "100%", height: "auto" %>
- S07E07 + S0<%= @serie.seasons.first.number %>E0<%= @serie.seasons.first.episodes.first.number %>
diff --git a/app/views/static_pages/home.html.erb b/app/views/static_pages/home.html.erb index 414a377..7d331ac 100644 --- a/app/views/static_pages/home.html.erb +++ b/app/views/static_pages/home.html.erb @@ -55,17 +55,19 @@
- <% 8.times do %> + <% Series.all.each do |s| %>
- <%= image_tag "american-horror-story.jpg" %> + <%= link_to series_path(s) do %> + <%= image_tag s.image_path %> + <% end %>
- S07E07 + S0<%= s.seasons.first.number %>E0<%= s.seasons.first.episodes.first.number %>
- American Horror Story + <%= s.title %>
Próximo episódio: amanhã diff --git a/app/views/static_pages/my_series.html.erb b/app/views/static_pages/my_series.html.erb index f98a3a7..f78facd 100644 --- a/app/views/static_pages/my_series.html.erb +++ b/app/views/static_pages/my_series.html.erb @@ -32,18 +32,18 @@
<% @series.each do |s| %>
-
+
- <%= link_to series_path(s) do %> - <%= image_tag "american-horror-story.jpg" %> - <% end %> + <%= link_to series_path(s) do %> + <%= image_tag s.image_path %> + <% end %>
- S07E07 -
-
-
-
+ S0<%= s.seasons.first.number %>E0<%= s.seasons.first.episodes.first.number %> +
+
+
+
<%= s.title %>
diff --git a/coverage/.last_run.json b/coverage/.last_run.json index 3cb5e70..2dbdba6 100644 --- a/coverage/.last_run.json +++ b/coverage/.last_run.json @@ -1,5 +1,5 @@ { "result": { - "covered_percent": 100.0 + "covered_percent": 98.04 } } diff --git a/coverage/.resultset.json b/coverage/.resultset.json index 68fb86b..6db07d0 100644 --- a/coverage/.resultset.json +++ b/coverage/.resultset.json @@ -8,14 +8,15 @@ 1, 1, 1, + 1, null ], "/home/rafael/ES022017/spec/models/favorite_spec.rb": [ 1, null, 1, - 2, - 2, + 1, + 1, null ], "/home/rafael/ES022017/app/models/favorite.rb": [ @@ -28,14 +29,14 @@ 1, null, 1, - 2, - null, - 2, - 2, + 1, null, 1, 1, null, + 1, + 0, + null, null, null ], @@ -51,8 +52,8 @@ 1, null, 1, - 2, - 2, + 1, + 1, null ], "/home/rafael/ES022017/app/models/series_list.rb": [ @@ -66,12 +67,12 @@ 1, null, 1, - 2, - 2, - 2, - 2, + 1, + 1, + 1, + 1, null, - 2, + 1, null ], "/home/rafael/ES022017/app/models/series.rb": [ @@ -88,14 +89,14 @@ 1, null, 1, - 2, + 1, null, - 2, - 2, - 2, + 1, + 1, + 1, null ] }, - "timestamp": 1511815349 + "timestamp": 1511815560 } } diff --git a/coverage/index.html b/coverage/index.html index 2bd9073..2948158 100644 --- a/coverage/index.html +++ b/coverage/index.html @@ -14,27 +14,27 @@ loading