app/models/campaign.rb in e9_crm-0.1.8 vs app/models/campaign.rb in e9_crm-0.1.10

- old
+ new

@@ -24,12 +24,17 @@ def self.default NoCampaign.first || NoCampaign.create end + validates :name, :presence => true, + :uniqueness => { :allow_blank => true, :case_sensitive => false } + validates :code, :presence => { :unless => lambda {|r| r.is_a?(NoCampaign) } }, - :length => { :maximum => 32 }, - :uniqueness => { :ignore_case => true, :allow_blank => true } + :length => { :maximum => 32 }, + :format => { :allow_blank => true, :with => /^[\w\d]+$/ }, + :uniqueness => { :case_sensitive => false, :allow_blank => true } + validates :affiliate_fee, :numericality => true validates :sales_fee, :numericality => true scope :active, lambda {|val=true| where(:active => val) } scope :inactive, lambda { active(false) }