From 9952bf52b57e4919be904fc2b099b3a21bea73f0 Mon Sep 17 00:00:00 2001 From: Ari Timonen Date: Mon, 16 Mar 2020 03:12:22 +0200 Subject: [PATCH] Fix country for undefined --- Gemfile.lock | 7 ------- app/models/user.rb | 6 +++++- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index bc69dd5..ad1189c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,9 +1,3 @@ -GIT - remote: git://github.com/anton-zaytsev/acts_as_rateable.git - revision: 01066eceb2d16e35be437b7392cc3375f1f377f7 - specs: - acts_as_rateable (3.0.0) - GIT remote: https://github.com/koraktor/steam-condenser-ruby.git revision: 2cb441f0518a0b8d20a017dfcc42783ae878311a @@ -333,7 +327,6 @@ PLATFORMS DEPENDENCIES active_link_to (~> 1.0.2) active_record_union - acts_as_rateable! annotate bbcoder (~> 1.0.1) better_errors diff --git a/app/models/user.rb b/app/models/user.rb index b530d7f..25e454e 100755 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -145,7 +145,11 @@ class User < ActiveRecord::Base def country_s country_object = ISO3166::Country[country] - country_object.translations[I18n.locale.to_s] || country_object.name + if country_object + country_object.translations[I18n.locale.to_s] || country_object.name + else + "Unknown" + end end def realname