blob: d03c584f959f8aba122d75ee7e5b7445cfc06468 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
module Pokeviewer
class Item < ApplicationRecord
validates :name, presence: true
belongs_to :move, optional: true
validates :move, presence: true, if: :tm?
validates :rs_description, presence: true, unless: :tm?
validates :frlg_description, presence: true, unless: :tm?
def description(game)
if game == :emerald
if not emerald_description.nil?
emerald_description
elsif not rs_description.nil?
rs_description
else
move.description game
end
elsif game == :firered or game == :leafgreen
if not frlg_description.nil?
frlg_description
else
move.description game
end
else
if not rs_description.nil?
rs_description
else
move.description game
end
end
end
def icon_path
if tm?
"pokeviewer/items/tms/#{move.move_type}.png"
else
"pokeviewer/items/#{id}.png"
end
end
end
end
|