Skip to content

Commit

Permalink
Atualiza séries
Browse files Browse the repository at this point in the history
  • Loading branch information
rafael-fernandes committed Nov 27, 2017
1 parent 8bec925 commit effbb8b
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 77 deletions.
1 change: 1 addition & 0 deletions app/models/series.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ class Series < ApplicationRecord
validates :title, presence: true
validates :description, presence: true
validates :year, presence: true
validates :image_path, presence: true
end
4 changes: 2 additions & 2 deletions app/views/series/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
<div class="series-card">
<div class="photo">
<%= link_to series_path(s) do %>
<%= image_tag "american-horror-story.jpg" %>
<% end %>
<%= image_tag s.image_path %>
<% end %>
</div>
<div class="episode">
S07E07
Expand Down
8 changes: 4 additions & 4 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ default: &default

development:
<<: *default
username: "es022017"
password: "password"
# username: "es022017"
# password: "password"
database: es022017_development
host: localhost

Expand All @@ -30,8 +30,8 @@ development:
# Do not set this db to the same as development or production.
test:
<<: *default
username: "es022017"
password: "password"
# username: "es022017"
# password: "password"
database: es022017_test
host: localhost

Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20171127203309_add_image_path_to_series.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddImagePathToSeries < ActiveRecord::Migration[5.0]
def change
add_column :series, :image_path, :string
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20171126210039) do
ActiveRecord::Schema.define(version: 20171127203309) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -49,6 +49,7 @@
t.string "year"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "image_path"
end

create_table "series_lists", force: :cascade do |t|
Expand Down
106 changes: 36 additions & 70 deletions db/seeds.rb
Original file line number Diff line number Diff line change
@@ -1,70 +1,36 @@
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.create(title: "American Horror Story", description: "1111", year: "2010")
Series.destroy_all

Series.create(
title: "Supergirl",
description: "Twenty-four-year-old Kara Zor-El, who was taken in by the Danvers family when she was 13 after being sent away from Krypton, must learn to embrace her powers after previously hiding them. The Danvers teach her to be careful with her powers, until she has to reveal them during an unexpected disaster, setting her on her journey of heroism.",
year: "2015",
image_path: "https://static.next-episode.net/tv-shows-images/huge/supergirl.jpg"
)

Series.create(
title: "Arrow",
description: "Arrow is a modern retelling of the adventures of legendary DC hero Green Arrow.",
year: "2012",
image_path: "https://static.next-episode.net/tv-shows-images/huge/arrow.jpg"
)

Series.create(
title: "The Good Doctor",
description: "The Good Doctor centers on a young surgeon with Savant Syndrome who is recruited into the pediatric surgical unit of a prestigious hospital. The question will arise - can a person who doesn't have the ability to relate to people actually save their lives?",
year: "2017",
image_path: "https://static.next-episode.net/tv-shows-images/huge/the-good-doctor.jpg"
)

Series.create(
title: "The Flash",
description: "The show centers around scientist Barry Allen, who suffers a freak accident that turns him into a superhero with the power of incredible speed. This version of The Flash started with a recurring character on Arrow.",
year: "2014",
image_path: "https://static.next-episode.net/tv-shows-images/huge/the-flash.jpg"
)

Series.create(
title: "The Flash",
description: "The show centers around scientist Barry Allen, who suffers a freak accident that turns him into a superhero with the power of incredible speed. This version of The Flash started with a recurring character on Arrow.",
year: "2014",
image_path: "https://static.next-episode.net/tv-shows-images/huge/the-flash.jpg"
)
1 change: 1 addition & 0 deletions spec/models/season_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

it { should validate_presence_of :name }
it { should validate_presence_of :number }
it { should validate_presence_of :image_path }

it do
should validate_numericality_of(:number).
Expand Down

0 comments on commit effbb8b

Please sign in to comment.