Merge pull request #2295 from wairbut-m2c/aperez-mappable-objects
Improvements for Mappable objects
This commit is contained in:
@@ -5,7 +5,7 @@ module Mappable
|
||||
attr_accessor :skip_map
|
||||
|
||||
has_one :map_location, dependent: :destroy
|
||||
accepts_nested_attributes_for :map_location, allow_destroy: true
|
||||
accepts_nested_attributes_for :map_location, allow_destroy: true, reject_if: :all_blank
|
||||
|
||||
validate :map_must_be_valid, on: :create, if: :feature_maps?
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ class MapLocation < ActiveRecord::Base
|
||||
belongs_to :proposal, touch: true
|
||||
belongs_to :investment, class_name: Budget::Investment, touch: true
|
||||
|
||||
validates :longitude, :latitude, :zoom, presence: true
|
||||
|
||||
def available?
|
||||
latitude.present? && longitude.present? && zoom.present?
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user