```ruby
class MapLayer < ActiveRecord::Base
def self.table_name()
 "mapscan_layers"
end
belongs_to :layer
belongs_to :map, :foreign_key => "mapscan_id"
end
```

Add validation to map layers join model to ensure that a map can not have multiple layers the same
user
```ruby
class MapLayer < ActiveRecord::Base
def self.table_name()
 "mapscan_layers"
end
belongs_to :layer
belongs_to :map, :foreign_key => "mapscan_id"
validates_uniqueness_of :layer_id, :scope => :mapscan_id, :message => "Layer already has this map"

end
```
assistant