delete_if threw errors, so convert things to arrays for it

This commit is contained in:
Devin Howard 2015-09-19 17:08:12 +08:00
parent 1aa4d862a1
commit 6692c28965

View file

@ -72,9 +72,9 @@ class MapsController < ApplicationController
respond_to do |format|
format.html {
@allmappers = @map.contributors
@alltopics = @map.topics.delete_if {|t| t.permission == "private" && (!authenticated? || (authenticated? && @current.id != t.user_id)) }
@allsynapses = @map.synapses.delete_if {|s| s.permission == "private" && (!authenticated? || (authenticated? && @current.id != s.user_id)) }
@allmappings = @map.mappings.delete_if {|m|
@alltopics = @map.topics.to_a.delete_if {|t| t.permission == "private" && (!authenticated? || (authenticated? && @current.id != t.user_id)) }
@allsynapses = @map.synapses.to_a.delete_if {|s| s.permission == "private" && (!authenticated? || (authenticated? && @current.id != s.user_id)) }
@allmappings = @map.mappings.to_a.delete_if {|m|
if m.category == "Synapse"
object = m.synapse
elsif m.category == "Topic"
@ -100,9 +100,9 @@ class MapsController < ApplicationController
end
@allmappers = @map.contributors
@alltopics = @map.topics.delete_if {|t| t.permission == "private" && (!authenticated? || (authenticated? && @current.id != t.user_id)) }
@allsynapses = @map.synapses.delete_if {|s| s.permission == "private" && (!authenticated? || (authenticated? && @current.id != s.user_id)) }
@allmappings = @map.mappings.delete_if {|m|
@alltopics = @map.topics.to_a.delete_if {|t| t.permission == "private" && (!authenticated? || (authenticated? && @current.id != t.user_id)) }
@allsynapses = @map.synapses.to_a.delete_if {|s| s.permission == "private" && (!authenticated? || (authenticated? && @current.id != s.user_id)) }
@allmappings = @map.mappings.to_a.delete_if {|m|
if m.category == "Synapse"
object = m.synapse
elsif m.category == "Topic"