about summary refs log tree commit diff stats
path: root/app/models
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2017-09-23 10:33:18 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2017-09-23 10:33:18 -0400
commite21e91ab9eefd9db5e73a67afca5087e4dd293fd (patch)
tree6e13aa2552721323557cb5a517e1f241ec1dc5b9 /app/models
parentf6cdc2fd2f50224fb7dd31d3ccb374cf4ffe7b6d (diff)
downloadpokeviewer-e21e91ab9eefd9db5e73a67afca5087e4dd293fd.tar.gz
pokeviewer-e21e91ab9eefd9db5e73a67afca5087e4dd293fd.tar.bz2
pokeviewer-e21e91ab9eefd9db5e73a67afca5087e4dd293fd.zip
Started writing extractor
Diffstat (limited to 'app/models')
-rw-r--r--app/models/pokeviewer/pokemon.rb2
-rw-r--r--app/models/pokeviewer/revision.rb10
2 files changed, 11 insertions, 1 deletions
diff --git a/app/models/pokeviewer/pokemon.rb b/app/models/pokeviewer/pokemon.rb index 114e9dd..3b750ac 100644 --- a/app/models/pokeviewer/pokemon.rb +++ b/app/models/pokeviewer/pokemon.rb
@@ -4,7 +4,7 @@ module Pokeviewer
4 4
5 belongs_to :species 5 belongs_to :species
6 belongs_to :trainer, optional: true 6 belongs_to :trainer, optional: true
7 has_many :revisions, dependent: :destroy 7 has_many :revisions, -> { order "sequential_id ASC" }, dependent: :destroy
8 8
9 validate :uuid_is_constant, on: :update 9 validate :uuid_is_constant, on: :update
10 before_create :set_uuid 10 before_create :set_uuid
diff --git a/app/models/pokeviewer/revision.rb b/app/models/pokeviewer/revision.rb index 9d1ddf4..4cafd07 100644 --- a/app/models/pokeviewer/revision.rb +++ b/app/models/pokeviewer/revision.rb
@@ -1,5 +1,15 @@
1require 'active_record/diff'
2
1module Pokeviewer 3module Pokeviewer
2 class Revision < ApplicationRecord 4 class Revision < ApplicationRecord
5 include ActiveRecord::Diff
6
7 diff :nickname, :experience, :level, :hp, :attack, :defense,
8 :special_attack, :special_defense, :speed, :coolness, :beauty, :cuteness,
9 :smartness, :toughness, :sheen, :hold_item, :move_1_id, :move_2_id,
10 :move_3_id, :move_4_id, :move_1_pp_bonuses, :move_2_pp_bonuses,
11 :move_3_pp_bonuses, :move_4_pp_bonuses
12
3 belongs_to :pokemon 13 belongs_to :pokemon
4 acts_as_sequenced scope: :pokemon_id 14 acts_as_sequenced scope: :pokemon_id
5 15