aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2017-07-06 14:21:41 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2017-07-06 14:21:41 -0700
commit973a2a29df3e27ec6cf0fc2fd165017fab98a922 (patch)
tree3bf0df5262ed45b3991351fb10e88211948e3ebf
parentdb: capture schema update. (diff)
downloadglsamaker-973a2a29df3e27ec6cf0fc2fd165017fab98a922.tar.gz
glsamaker-973a2a29df3e27ec6cf0fc2fd165017fab98a922.tar.bz2
glsamaker-973a2a29df3e27ec6cf0fc2fd165017fab98a922.zip
models/package: Re-order calls.2.1.4
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rw-r--r--app/models/package.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/app/models/package.rb b/app/models/package.rb
index 8f2547d..30fb1bd 100644
--- a/app/models/package.rb
+++ b/app/models/package.rb
@@ -12,10 +12,6 @@
# Package model
class Package < ActiveRecord::Base
- belongs_to :revision
- validates :comp, :inclusion => { :in => COMP_MAP.keys }
- validates :arch, :format => { :with => /\A(\*|(#{ARCHLIST_REGEX} )*#{ARCHLIST_REGEX})\z/ }
-
# Mapping XML comparators to internally used ones
COMP_MAP = {
'>=' => 'ge',
@@ -36,6 +32,11 @@ class Package < ActiveRecord::Base
ARCHLIST = (ARCHLIST_BASE+ARCHLIST_FBSD+ARCHLIST_PREFIX).freeze
ARCHLIST_REGEX = %r{(?:#{ARCHLIST.join('|')})}.freeze
+ # Model properties
+ belongs_to :revision
+ validates :comp, :inclusion => { :in => COMP_MAP.keys }
+ validates :arch, :format => { :with => /\A(\*|(#{ARCHLIST_REGEX} )*#{ARCHLIST_REGEX})\z/ }
+
# Returns the comparator in the format needed for the XML
def xml_comp
COMP_MAP[self.comp]