diff options
| author | Michel Etienne | 2015-10-26 16:28:01 +0100 |
|---|---|---|
| committer | Michel Etienne | 2015-10-26 16:28:01 +0100 |
| commit | da5dab112c875ac4e63089270b5ca3504cb73fa8 (patch) | |
| tree | f4a68594d5cf398ee99316552e7ec92088cf5fbf /lib | |
| parent | 801c4a73eb3c2bf2ba756949fccdc587740b2284 (diff) | |
| download | chouette-core-da5dab112c875ac4e63089270b5ca3504cb73fa8.tar.bz2 | |
HUB profile corrcetions
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/ninoxe_extension/hub/objectid_restrictions.rb | 6 | ||||
| -rw-r--r-- | lib/ninoxe_extension/hub/stop_area_restrictions.rb | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/ninoxe_extension/hub/objectid_restrictions.rb b/lib/ninoxe_extension/hub/objectid_restrictions.rb index 1fcdb94cb..1a71b9e62 100644 --- a/lib/ninoxe_extension/hub/objectid_restrictions.rb +++ b/lib/ninoxe_extension/hub/objectid_restrictions.rb @@ -8,15 +8,15 @@ module NinoxeExtension::Hub::ObjectidRestrictions end def validate_specific_objectid( size_max ) - errors.add( :objectid, I18n.t('hub.invalid')) if ( %r{\A\w+:\w+:\w+\z}).match( self.objectid).nil? + #errors.add( :objectid, I18n.t('hub.invalid')) if ( %r{\A\w+:\w+:\w+\z}).match( self.objectid).nil? if third_part_objectid.nil? || ( !third_part_objectid.include?( "_pending_" ) && third_part_objectid.size > size_max) errors.add( :objectid, I18n.t('hub.invalid')) end end def third_part_objectid - return nil if ( %r{\A\w+:\w+:\w+\z}).match( self.objectid).nil? - self.objectid.match(/:(\w+)\z/)[1] + return nil if ( %r{\A\w+:\w+:[0-9A-Za-z_-]+\z}).match( self.objectid).nil? + self.objectid.match(/:([0-9A-Za-z_-]+)\z/)[1] end def third_part_objectid_uniqueness return unless hub_restricted? diff --git a/lib/ninoxe_extension/hub/stop_area_restrictions.rb b/lib/ninoxe_extension/hub/stop_area_restrictions.rb index 8d347a7c6..fb5f81598 100644 --- a/lib/ninoxe_extension/hub/stop_area_restrictions.rb +++ b/lib/ninoxe_extension/hub/stop_area_restrictions.rb @@ -56,7 +56,7 @@ module NinoxeExtension::Hub # HUB-31 # sa.validates_format_of :comment, :with => %r{\A[\w ]{0,255}\z} sa.validates_length_of :comment, :maximum => 255, :allow_blank => true, :allow_nil => true - sa.validates_format_of :registration_number, :with => %r{\A[\w]{1,8}\z}, :allow_blank => true, :allow_nil => true + sa.validates :registration_number, :numericality => { :less_than => 10 ** 8 }, :allow_blank => true, :allow_nil => true end end def specific_objectid |
