lib/light/services/class_based_collection/base.rb in light-services-2.0.0.rc9 vs lib/light/services/class_based_collection/base.rb in light-services-2.0
- old
+ new
@@ -74,10 +74,10 @@
end
end
def insert_item(klass, name, opts, item)
index = find_index(klass, opts[:before] || opts[:after])
- index = opts[:before] ? index : index + 1
+ index += 1 unless opts[:before]
@collection[klass] = @collection[klass].to_a.insert(index, [name, item]).to_h
end
end
end