diff --git a/app/helpers/wow_mounts_helper.rb b/app/helpers/wow_mounts_helper.rb index 33339fa..4e24276 100644 --- a/app/helpers/wow_mounts_helper.rb +++ b/app/helpers/wow_mounts_helper.rb @@ -1,4 +1,7 @@ # frozen_string_literal: true module WowMountsHelper + def mount_owned?(mount) + mount.users.include? current_user + end end diff --git a/app/helpers/wow_pets_helper.rb b/app/helpers/wow_pets_helper.rb index cbf0494..732dc6c 100644 --- a/app/helpers/wow_pets_helper.rb +++ b/app/helpers/wow_pets_helper.rb @@ -1,4 +1,7 @@ # frozen_string_literal: true module WowPetsHelper + def pet_owned?(pet) + pet.users.include? current_user + end end diff --git a/app/models/wow_pet_ability.rb b/app/models/wow_pet_ability.rb index db5ecb2..042fa8d 100644 --- a/app/models/wow_pet_ability.rb +++ b/app/models/wow_pet_ability.rb @@ -4,8 +4,8 @@ class WowPetAbility < ApplicationRecord extend Mobility translates :name, :translated_battle_pet_type - has_many :learned_pet_abilities, dependent: :destroy - has_many :wow_pets, through: :learned_pet_abilities + has_many :learned_wow_pet_abilities, dependent: :destroy + has_many :wow_pets, through: :learned_wow_pet_abilities validates :name, presence: true validates :ability_id, presence: true, uniqueness: true diff --git a/app/views/wow_characters/show.html.erb b/app/views/wow_characters/show.html.erb index 9969285..f7c394c 100644 --- a/app/views/wow_characters/show.html.erb +++ b/app/views/wow_characters/show.html.erb @@ -8,7 +8,7 @@
<%= @wow_character.gender_race_name %>
<%= @wow_character.gender_class_name %>
-<%= @wow_character.last_login_timestamp %>
+Last connection: <%= @wow_character.last_login_timestamp %>
Last position: Map: <%= @wow_character.last_position.wow_geo_map.name %> Zone: <%= @wow_character.last_position.wow_geo_zone.name %>
Bind position: Map: <%= @wow_character.bind_position.wow_geo_map.name %> Zone: <%= @wow_character.bind_position.wow_geo_zone.name %>
Go somewhere diff --git a/app/views/wow_mounts/index.html.erb b/app/views/wow_mounts/index.html.erb index b2909a4..52b4490 100644 --- a/app/views/wow_mounts/index.html.erb +++ b/app/views/wow_mounts/index.html.erb @@ -8,6 +8,7 @@<%= mount.description %>
+Owned: <%= mount_owned?(mount) %>
<%= link_to 'Detail', mount, class: "btn btn-primary" %><%= pet.description %>
+Owned: <%= pet_owned?(pet) %>
<%= link_to 'Detail', pet, class: "btn btn-primary" %>