blob: 269cf9725e8a6701af7d80153b1baa2b9add093b (
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
|
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?
"items/tms/#{move.move_type}.png"
else
"items/#{id}.png"
end
end
end
|