Skip to content

Commit

Permalink
Validate account attributes only for new record. Existing account req…
Browse files Browse the repository at this point in the history
…uires only id for subscribe call.
  • Loading branch information
bblimke committed Jul 18, 2012
1 parent d08e1e0 commit a2595f1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/zuora/objects/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ class Account < Base
belongs_to :bill_to, :class_name => 'Contact'
belongs_to :sold_to, :class_name => 'Contact'

validates_presence_of :account_number, :name, :status, :payment_term, :batch, :currency
validates_length_of :name, :maximum => 50
validates_presence_of :account_number, :name, :status, :payment_term, :batch, :currency, :if => :new_record?
validates_length_of :name, :maximum => 50, :if => :new_record?
validates_length_of :purchase_order_number, :maximum => 100, :allow_nil => true
validates_inclusion_of :payment_term, :in => ['Due Upon Receipt','Net 30','Net 45','Net 90']
validates_inclusion_of :batch, :in => (1..20).map{|n| "Batch#{n}" }
validates_inclusion_of :payment_term, :in => ['Due Upon Receipt','Net 30','Net 45','Net 90'], :if => :new_record?
validates_inclusion_of :batch, :in => (1..20).map{|n| "Batch#{n}" }, :if => :new_record?
validates_inclusion_of :bcd_setting_option, :in => ['AutoSet','ManualSet'], :allow_nil => true
validates_inclusion_of :bill_cycle_day, :in => (0..30).to_a + (0..30).map(&:to_s)
validates_inclusion_of :bill_cycle_day, :in => (0..30).to_a + (0..30).map(&:to_s), :if => :new_record?
validates_inclusion_of :status, :in => ['Draft','Active','Canceled'], :allow_nil => true

define_attributes do
Expand Down

0 comments on commit a2595f1

Please sign in to comment.