Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2765 Fix geocoding to display enterprises on map #2872

Merged
merged 10 commits into from
Oct 22, 2018
23 changes: 0 additions & 23 deletions app/models/spree/address_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,4 @@ def address_part2
def touch_enterprise
enterprise.andand.touch
end

# We have a hard-to-track-down bug around invalid addresses with all-nil fields finding
# their way into the database. I don't know what the source of them is, so this patch
# is designed to track them down.
# This is intended to be a temporary investigative measure, and should be removed from the
# code base shortly. If it's past 17-10-2013, take it out.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's exactly 5 years later!!!

#
#-- Rohan, 17-9-2913
def create
if self.zipcode.nil?
Bugsnag.notify RuntimeError.new('Creating a Spree::Address with nil values')
end

super
end

def update(attribute_names = @attributes.keys)
if self.zipcode.nil?
Bugsnag.notify RuntimeError.new('Updating a Spree::Address with nil values')
end

super(attribute_names)
end
end
15 changes: 0 additions & 15 deletions spec/models/spree/addresses_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,4 @@
expect { Spree::Address.new.country = "A country" }.to raise_error ActiveRecord::AssociationTypeMismatch
end
end

describe "notifying bugsnag when saved with missing data" do
it "notifies on create" do
Bugsnag.should_receive(:notify)
a = Spree::Address.new zipcode: nil
a.save validate: false
end

it "notifies on update" do
Bugsnag.should_receive(:notify)
a = create(:address)
a.zipcode = nil
a.save validate: false
end
end
end