diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-09-23 10:33:18 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-09-23 10:33:18 -0400 |
commit | e21e91ab9eefd9db5e73a67afca5087e4dd293fd (patch) | |
tree | 6e13aa2552721323557cb5a517e1f241ec1dc5b9 /app/models | |
parent | f6cdc2fd2f50224fb7dd31d3ccb374cf4ffe7b6d (diff) | |
download | pokeviewer-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.rb | 2 | ||||
-rw-r--r-- | app/models/pokeviewer/revision.rb | 10 |
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 @@ | |||
1 | require 'active_record/diff' | ||
2 | |||
1 | module Pokeviewer | 3 | module 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 | ||