summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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]