Merge pull request #474 from metamaps/feature/fix-synapse-mappings

don't need xloc or yloc for Synapse mappings
This commit is contained in:
Devin Howard 2016-02-22 12:33:05 +08:00
commit cb43ebce92

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