diff --git a/app/models/create_enterprise.rb b/app/models/create_enterprise.rb index a2a63d4..2521d19 100644 --- a/app/models/create_enterprise.rb +++ b/app/models/create_enterprise.rb @@ -16,13 +16,13 @@ class CreateEnterprise < Task settings_items field.to_sym end - # checks for virtual attributes + # checks for virtual attributes validates_presence_of :name, :identifier #checks if the validation method is region to validates validates_presence_of :region_id, :if => lambda { |obj| obj.environment.organization_approval_method == :region } - validates_format_of :foundation_year, :with => /^\d*$/ + validates_format_of :foundation_year, :with => /\d*/ # checks for actual attributes validates_presence_of :requestor_id, :target_id @@ -127,7 +127,7 @@ class CreateEnterprise < Task finish end - # tells if this request was appoved + # tells if this request was appoved def approved? self.status == Task::Status::FINISHED end diff --git a/app/models/domain.rb b/app/models/domain.rb index a5fb478..052bd86 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -14,7 +14,7 @@ class Domain < ActiveRecord::Base # name must be sequences of alphanumeric characters (a to z, # 0 to 9), plus '_' or '-', separated by dots. Letters must be lowercase. - validates_format_of :name, :with => /^([a-z0-9_-]+\.)+[a-z0-9_-]+$/, :message => N_('{fn} must be composed of sequences of lowercase letters (a to z), numbers (0 to 9), "_" and "-", separated by dots.').fix_i18n + validates_format_of :name, :with => /([a-z0-9_-]+\.)+[a-z0-9_-]+/, :message => N_('{fn} must be composed of sequences of lowercase letters (a to z), numbers (0 to 9), "_" and "-", separated by dots.').fix_i18n # checks validations that could not be expressed using Rails' predefined # validations. In particular: diff --git a/app/models/profile.rb b/app/models/profile.rb index 7c5a0e9..81eb3bf 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -182,7 +182,7 @@ class Profile < ActiveRecord::Base validates_length_of :description, :maximum => 550, :allow_nil => true # Valid identifiers must match this format. - IDENTIFIER_FORMAT = /^#{Noosfero.identifier_format}$/ + IDENTIFIER_FORMAT = /#{Noosfero.identifier_format}/ # These names cannot be used as identifiers for Profiles RESERVED_IDENTIFIERS = %w[ diff --git a/app/models/rss_feed.rb b/app/models/rss_feed.rb index 31ed89f..97dd9aa 100644 --- a/app/models/rss_feed.rb +++ b/app/models/rss_feed.rb @@ -14,7 +14,7 @@ class RssFeed < Article # store setting in body serialize :body, Hash - + def body self[:body] ||= {} end @@ -40,7 +40,7 @@ class RssFeed < Article # FIXME this should be validates_numericality_of, but Rails 2.0.2 does not # support validates_numericality_of with virtual attributes - validates_format_of :limit, :with => /^\d+$/, :if => :limit + validates_format_of :limit, :with => /\d+/, :if => :limit # determinates what to include in the feed. Possible values are +:all+ # (include everything from the profile) and :parent_and_children (include -- libgit2 0.21.2