fix map forking (fix #540)

This commit is contained in:
Devin Howard 2016-04-20 08:51:38 +08:00
parent 7bb7f345f1
commit 837e4bde1b

View file

@ -162,13 +162,13 @@ class MapsController < ApplicationController
@all = @all.split(',') @all = @all.split(',')
@all.each do |topic| @all.each do |topic|
topic = topic.split('/') topic = topic.split('/')
mapping = Mapping.new() mapping = Mapping.new
mapping.map = @map
mapping.user = @user mapping.user = @user
mapping.mappable = Topic.find(topic[0]) mapping.mappable = Topic.find(topic[0])
mapping.xloc = topic[1] mapping.xloc = topic[1]
mapping.yloc = topic[2] mapping.yloc = topic[2]
@map.topicmappings << mapping authorize mapping, :create?
authorize mapping, :create
mapping.save mapping.save
end end
@ -176,12 +176,11 @@ class MapsController < ApplicationController
@synAll = params[:synapsesToMap] @synAll = params[:synapsesToMap]
@synAll = @synAll.split(',') @synAll = @synAll.split(',')
@synAll.each do |synapse_id| @synAll.each do |synapse_id|
mapping = Mapping.new() mapping = Mapping.new
mapping.user = @user
mapping.map = @map mapping.map = @map
mapping.user = @user
mapping.mappable = Synapse.find(synapse_id) mapping.mappable = Synapse.find(synapse_id)
@map.synapsemappings << mapping authorize mapping, :create?
authorize mapping, :create
mapping.save mapping.save
end end
end end