diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2017-07-06 14:21:41 -0700 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2017-07-06 14:21:41 -0700 |
commit | 973a2a29df3e27ec6cf0fc2fd165017fab98a922 (patch) | |
tree | 3bf0df5262ed45b3991351fb10e88211948e3ebf | |
parent | db: capture schema update. (diff) | |
download | glsamaker-2.1.4.tar.gz glsamaker-2.1.4.tar.bz2 glsamaker-2.1.4.zip |
models/package: Re-order calls.2.1.4
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rw-r--r-- | app/models/package.rb | 9 |
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] |