Skip to content

Commit

Permalink
Merge pull request #22 from cthonney/geocodingsea-tcm
Browse files Browse the repository at this point in the history
add sea if nil
  • Loading branch information
cthonney authored Oct 28, 2023
2 parents d8acff7 + 2d3281a commit 6613e7f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/models/disaster.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
class Disaster < ApplicationRecord
reverse_geocoded_by :latitude, :longitude
after_validation :reverse_geocode
after_validation :set_default_address
has_many :reviews, dependent: :destroy

def set_default_address
# Attribuer "sea" si l'attribut de géolocalisation est nil
self.address ||= "Sea" if self.address.nil?
end
end

0 comments on commit 6613e7f

Please sign in to comment.