Skip to content

Commit 52fdbfe

Browse files
committed
fix case where finder returns nil
1 parent fab03b7 commit 52fdbfe

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

ruby/hyper-model/lib/active_record_base.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def finder_method(name, &block)
8787
this.acting_user = acting_user
8888
# returns a PsuedoRelationArray which will respond to the
8989
# __secure_collection_check method
90-
ReactiveRecordPsuedoRelationArray.new([this.instance_exec(*args, &block)])
90+
ReactiveRecordPsuedoRelationArray.new([*this.instance_exec(*args, &block)])
9191
ensure
9292
this.acting_user = old
9393
end

ruby/hyper-model/spec/batch3/edge_cases_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,19 @@ class TestComponent77 < HyperComponent
135135
FactoryBot.create(:todo, title: 'todo 2', completed: true)
136136
FactoryBot.create(:todo, title: 'todo 1', completed: false)
137137
FactoryBot.create(:todo, title: 'todo 2', completed: false)
138+
#evaluate_ruby "Hyperstack::Model.load { Todo.completed.find_by_title('todo 2').id }"
138139
expect_promise do
139140
Hyperstack::Model.load do
140141
Todo.completed.find_by_title('todo 2').id
141142
end
142143
end.to eq(Todo.completed.find_by_title('todo 2').id)
144+
binding.pry
145+
evaluate_ruby "Hyperstack::Model.load { Todo.completed.find_by_title('todo 3').present? }"
146+
evaluate_ruby do
147+
Hyperstack::Model.load do
148+
Todo.completed.find_by_title('todo 3').present?
149+
end
150+
end #.to be_falsy
143151
end
144152

145153
end

0 commit comments

Comments
 (0)