Commit 51d187449fcf3d0b5e2edd6f437141e0dd5db0b8
1 parent
19c55b10
Exists in
master
and in
1 other branch
Fixed #139, thanks to the suggestion from @gorenje
Showing
1 changed file
with
2 additions
and
1 deletions
Show diff stats
app/models/app.rb
@@ -81,7 +81,8 @@ class App | @@ -81,7 +81,8 @@ class App | ||
81 | end | 81 | end |
82 | 82 | ||
83 | def find_or_create_err!(attrs) | 83 | def find_or_create_err!(attrs) |
84 | - Err.where(attrs).first || problems.create!.errs.create!(attrs) | 84 | + Err.any_in(:problem_id => problems.map { |a| a.id }). |
85 | + where(attrs).first || problems.create!.errs.create!(attrs) | ||
85 | end | 86 | end |
86 | 87 | ||
87 | # Mongoid Bug: find(id) on association proxies returns an Enumerator | 88 | # Mongoid Bug: find(id) on association proxies returns an Enumerator |