don't need xloc or yloc for Synapse mappings

This commit is contained in:
Devin Howard 2016-02-21 17:25:39 +08:00
parent 1f1cd37553
commit 5b47527f46

View file

@ -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