From a1a5cb52277d45be323528159addab7971e585a5 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Fri, 13 Oct 2017 10:05:57 -0400 Subject: Fixed behavior of gift ribbons for Pokémon not in any game MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/pokeviewer/pokemon.rb | 8 ++++++++ app/models/pokeviewer/revision.rb | 14 +++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) (limited to 'app') diff --git a/app/models/pokeviewer/pokemon.rb b/app/models/pokeviewer/pokemon.rb index ab516fb..f65d68e 100644 --- a/app/models/pokeviewer/pokemon.rb +++ b/app/models/pokeviewer/pokemon.rb @@ -186,6 +186,14 @@ module Pokeviewer end end + def gift_ribbon_description(ribbon) + if trainer.nil? + "" + else + trainer.gift_ribbon_description(ribbon) + end + end + private def set_uuid diff --git a/app/models/pokeviewer/revision.rb b/app/models/pokeviewer/revision.rb index 2626ae3..e33ac4f 100644 --- a/app/models/pokeviewer/revision.rb +++ b/app/models/pokeviewer/revision.rb @@ -363,7 +363,7 @@ module Pokeviewer result << { filename: "marine-ribbon.png", name: "Marine Ribbon", - description: pokemon.trainer.gift_ribbon_description(:marine_ribbon) + description: pokemon.gift_ribbon_description(:marine_ribbon) } end @@ -371,7 +371,7 @@ module Pokeviewer result << { filename: "land-ribbon.png", name: "Land Ribbon", - description: pokemon.trainer.gift_ribbon_description(:land_ribbon) + description: pokemon.gift_ribbon_description(:land_ribbon) } end @@ -379,7 +379,7 @@ module Pokeviewer result << { filename: "sky-ribbon.png", name: "Sky Ribbon", - description: pokemon.trainer.gift_ribbon_description(:sky_ribbon) + description: pokemon.gift_ribbon_description(:sky_ribbon) } end @@ -387,7 +387,7 @@ module Pokeviewer result << { filename: "country-ribbon.png", name: "Country Ribbon", - description: pokemon.trainer.gift_ribbon_description(:country_ribbon) + description: pokemon.gift_ribbon_description(:country_ribbon) } end @@ -395,7 +395,7 @@ module Pokeviewer result << { filename: "national-ribbon.png", name: "National Ribbon", - description: pokemon.trainer.gift_ribbon_description(:national_ribbon) + description: pokemon.gift_ribbon_description(:national_ribbon) } end @@ -403,7 +403,7 @@ module Pokeviewer result << { filename: "earth-ribbon.png", name: "Earth Ribbon", - description: pokemon.trainer.gift_ribbon_description(:earth_ribbon) + description: pokemon.gift_ribbon_description(:earth_ribbon) } end @@ -411,7 +411,7 @@ module Pokeviewer result << { filename: "world-ribbon.png", name: "World Ribbon", - description: pokemon.trainer.gift_ribbon_description(:world_ribbon) + description: pokemon.gift_ribbon_description(:world_ribbon) } end -- cgit 1.4.1