Skip to content
This repository has been archived by the owner on Apr 17, 2020. It is now read-only.

Commit

Permalink
Remove extra condition from Address#editable?
Browse files Browse the repository at this point in the history
fixes #37
  • Loading branch information
romul committed Jan 11, 2013
1 parent b976d2d commit 051b19c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/spree/address_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ def same_as?(other)
attributes.except('id', 'updated_at', 'created_at', 'user_id') == other.attributes.except('id', 'updated_at', 'created_at', 'user_id')
end

# can modify an address if it's not been used in an order
# can modify an address if it's not been used in an completed order
def editable?
new_record? || (shipments.empty? && (Spree::Order.where("bill_address_id = ?", self.id).count + Spree::Order.where("bill_address_id = ?", self.id).count <= 1) && Spree::Order.complete.where("bill_address_id = ? OR ship_address_id = ?", self.id, self.id).count == 0)
new_record? || (shipments.empty? && Spree::Order.complete.where("bill_address_id = ? OR ship_address_id = ?", self.id, self.id).count == 0)
end

def can_be_deleted?
Expand Down

0 comments on commit 051b19c

Please sign in to comment.