Commit e05728dcdc79cb767fcd6f49664e5696f334353d
1 parent
8a0303c5
Exists in
master
Fixed Relation loaded error for non-mutating methods on relation - #1395
Showing
3 changed files
with
9 additions
and
0 deletions
Show diff stats
CHANGELOG.md
@@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
3 | - Added `model` method to `Searchkick::Relation` | 3 | - Added `model` method to `Searchkick::Relation` |
4 | - Fixed deprecation warning with `redis` gem | 4 | - Fixed deprecation warning with `redis` gem |
5 | - Fixed `respond_to?` method on relation loading relation | 5 | - Fixed `respond_to?` method on relation loading relation |
6 | +- Fixed `Relation loaded` error for non-mutating methods on relation | ||
6 | 7 | ||
7 | ## 5.0.4 (2022-06-16) | 8 | ## 5.0.4 (2022-06-16) |
8 | 9 |
lib/searchkick/relation.rb
test/relation_test.rb
@@ -7,6 +7,9 @@ class RelationTest < Minitest::Test | @@ -7,6 +7,9 @@ class RelationTest < Minitest::Test | ||
7 | refute products.loaded? | 7 | refute products.loaded? |
8 | assert_equal 0, products.count | 8 | assert_equal 0, products.count |
9 | assert products.loaded? | 9 | assert products.loaded? |
10 | + refute products.clone.loaded? | ||
11 | + refute products.dup.loaded? | ||
12 | + refute products.limit(2).loaded? | ||
10 | error = assert_raises(Searchkick::Error) do | 13 | error = assert_raises(Searchkick::Error) do |
11 | products.limit!(2) | 14 | products.limit!(2) |
12 | end | 15 | end |