Fix handling of ActiveStorage::Attached::One#446
Fix handling of ActiveStorage::Attached::One#446manuelmeurer wants to merge 1 commit intocrmne:mainfrom
Conversation
|
Alright, I figured it out! 🥳 |
b102e7b to
7790e0f
Compare
7790e0f to
7ddef70
Compare
7ddef70 to
e48e0d1
Compare
|
Rebased and squashed. @crmne Could you review when you have a minute? |
|
I found this issue independently today and need this fix, commenting for support! |
|
@crmne Could I ask you for a review please? |
|
Hello, I also had this sequence of errors (first the "undefined method 'blobs' and then after switching to has_many_attached "undefined method 'encode'"). My use case is specifically for parsing documents so it would be awesome if this could get merged. By the way, if anyone is blocked by this, I was able to circumvent the error by passing the blob path directly, e.g. |
What this does
This fixes the same problem as #380, i.e. when you call
RubyLLM::Chat.askand pass aActiveStorage::Attached::Oneobject as thewithparameter, it would try to callblobson the record instead ofblob.The reason that this went unnoticed was that the test that was supposed to test it, didn't. 😀
In fact, the "handles multiple attachments" and "handles attachments in ask method" tests in
acts_as_attachment_spec.rbwere duplicates of the tests with the same names inacts_as_spec.rb. Probably copy-pasted and then forgotten to adjust.I renamed and reordered the specs in
acts_as_specto make them easier to understand (but otherwise left the tests untouched) and renamed and rewrote the two tests inacts_as_attachment_spec.rb, so that they actually test that passingActiveStorage::Attached::OneandActiveStorage::Attached::Manyobjects work as expected.Unfortunately, the "handles ActiveStorage::Attached::Many in ask method" test fails locally for me with this error:
I suspect it's a problem with my local setup, but I can't even commit the failing test to git due to pre-commit hooks, so I don't know how to trigger CI with it to check if it passes. 🤷♂️
Type of change
Scope check
Quality check
overcommit --installand all hooks passbundle exec rake vcr:record[provider_name]bundle exec rspecmodels.json,aliases.json)API changes
Related issues
#380