Skip to content

Commit

Permalink
Make last names optional on Spree::Address
Browse files Browse the repository at this point in the history
For example, we're integrating with Amazon Payments right now and
Amazon doesn't require two names, which breaks this validation. And
it's hard to remove an ActiveRecord validation at the app level.
  • Loading branch information
jordan-brough committed Aug 3, 2016
1 parent 7cdf649 commit 7fe6670
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/app/models/spree/address.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Address < Spree::Base
belongs_to :country, class_name: "Spree::Country"
belongs_to :state, class_name: "Spree::State"

validates :firstname, :lastname, :address1, :city, :country_id, presence: true
validates :firstname, :address1, :city, :country_id, presence: true
validates :zipcode, presence: true, if: :require_zipcode?
validates :phone, presence: true, if: :require_phone?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
end

firstname 'John'
lastname 'Doe'
lastname nil
company 'Company'
address1 '10 Lovely Street'
address2 'Northwest'
Expand Down

0 comments on commit 7fe6670

Please sign in to comment.