Fix Mongoid Support#245
Conversation
There was a problem hiding this comment.
Thank you, @jpmermoz! Let a small non-blocking comment. I think the pipeline failures are unrelated, we probably just need to make more strict the gem files. I can do that in master soon if you are not able to get to that sooner.
And we should definitively add mongoid to the test matrix. It's long overdue
| column_attributes = respond_to?(:column_names) ? column_names : [] | ||
| fields_attributes = respond_to?(:fields) ? fields.keys : [] |
There was a problem hiding this comment.
Perhaps we could simplify a bit with
| column_attributes = respond_to?(:column_names) ? column_names : [] | |
| fields_attributes = respond_to?(:fields) ? fields.keys : [] | |
| column_attributes = try(:column_names) || [] | |
| fields_attributes = try(:fields) || [] |
There was a problem hiding this comment.
I like it.. I think the second line should be:
fields_attributes = try(:fields).try(:keys) || []
There was a problem hiding this comment.
Oh, I didn't notice the chain, so you'll need a safe operator in case try returns nil
fields_attributes = try(:fields)&.keys || []|
I agree @mcelicalderon |
|
@jpmermoz I turns out the failures were just a problem with CI cache. I merged a change to refresh dependency cache. Could you please rebase your branch against master? |
|
@mcelicalderon done! but it looks like there is still 1 failing check around rails7.0_graphql1.12.gemfile-3.0 |
|
@jpmermoz you should have updated you fork's master with the latest from this gem before rebasing. But don't worry, it was definitively a CI problem, so merging this one. Please let us know if everything worked as expected with Mongoid after this |
These 2 small fixes allows this project to be used with Mongoid instead of ActiveRecord.