From 5b47527f461008ed795ecb0b9c8559f6057757f3 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Sun, 21 Feb 2016 17:25:39 +0800 Subject: [PATCH] don't need xloc or yloc for Synapse mappings --- app/models/mapping.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/mapping.rb b/app/models/mapping.rb index 425f358d..d034de1c 100644 --- a/app/models/mapping.rb +++ b/app/models/mapping.rb @@ -7,8 +7,10 @@ class Mapping < ActiveRecord::Base belongs_to :map, :class_name => "Map", :foreign_key => "map_id", touch: true belongs_to :user - validates :xloc, presence: true - validates :yloc, presence: true + validates :xloc, presence: true, + unless: Proc.new { |m| m.mappable_type == 'Synapse' } + validates :yloc, presence: true, + unless: Proc.new { |m| m.mappable_type == 'Synapse' } validates :map, presence: true validates :mappable, presence: true