Skip to content

Commit cdd877b

Browse files
eladodblock
authored andcommitted
Make sure models array has uniq models (otherwise it piles up duplicates from previous calls and affects performance severly).
1 parent 15604b0 commit cdd877b

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
### 0.8.1 (Next)
22

33
* [#91](https://github.com/tim-vandecasteele/grape-swagger/issues/91): Fixed empty field for group parameters' name with type hash or Array - [@dukedave](https://github.com/dukedave).
4-
* [#154](https://github.com/tim-vandecasteele/grape-swagger/pull/154): Allow Classes for type declarations inside documentation - [@mrmargolis](https://github.com/mrmargolis).
4+
* [#154](https://github.com/tim-vandecasteele/grape-swagger/pull/154): Allow classes for type declarations inside documentation - [@mrmargolis](https://github.com/mrmargolis).
5+
* [#162](https://github.com/tim-vandecasteele/grape-swagger/pull/162): Fix performance issue related to having a large number of models - [@elado](https://github.com/elado).
56
* Your contribution here.
67

78
### 0.8.0 (August 30, 2014)

lib/grape-swagger.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,9 @@ def self.setup(options)
162162

163163
http_codes = parse_http_codes(route.route_http_codes, models)
164164

165-
models << @@models if @@models.present?
165+
models |= @@models if @@models.present?
166166

167-
models << route.route_entity if route.route_entity.present?
167+
models |= [route.route_entity] if route.route_entity.present?
168168

169169
models = models_with_included_presenters(models.flatten.compact)
170170

0 commit comments

Comments
 (0)