Sha256: d40a54c0295e2861fef92a19e222585c36d655286a86d8f4391bffc4c43615d3

Contents?: true

Size: 408 Bytes

Versions: 2

Compression:

Stored size: 408 Bytes

Contents

Spree::Order.class_eval do

  def valid_terms_and_conditions?
    self.errors[:terms_and_conditions] << 'must be accepted' unless self.terms_and_conditions == true
    self.errors[:terms_and_conditions].empty? ? true : false
  end

end

Spree::PermittedAttributes.checkout_attributes << :terms_and_conditions

Spree::Order.state_machine.before_transition :to => :payment, :do => :valid_terms_and_conditions?

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spree_terms_and_conditions-2.1.5 app/models/spree/order_decorator.rb
spree_terms_and_conditions-2.1.4 app/models/spree/order_decorator.rb