You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Way back in 2012, 016d66c changed the ::[] API to act as both a command and query, in a decision based on pragmatism. At the time, @bmabey noted his dislike for this, and his desire to deprecate it. Now that we're talking about a v2.0 release, I think this is a good time to talk about improving this situation in a backwards-incompatible way.
I have an alternative API proposal that I've been exploring, which splits the ::[] method into ::[] for queries, and ::[]= for commands. Complex configuration is also simplified to a hash, or array of hashes:
# complex multiple db configDatabaseCleaner[:active_record]=[{connection: :test,strategy: :truncation,except: %w[goatsdonkeys]},{connection: :test_2,strategy: :transaction},]
I have been working on a document exploring what this API change would look like for DatabaseCleaner's many different use-cases, ranging from the most simplistic all the way up to very complex multiple ORM and database configuration, and this seems like this could work well, while also simplifying internals. I haven't prototyped it yet to confirm, but I even think its possible to add API this to the 1.x series in a backwards-compatible way, which would ease the v2.0 transition.
However, I want to get some feedback on this general direction before going too deep down the rabbit hole. Perhaps there is already an alternative API that you folks have in mind? Or perhaps we don't want to change the API at all at this point? But if this API looks promising, I'll post the document, and we can go from there!
The text was updated successfully, but these errors were encountered:
In the interest of getting v2.0 out the door, I'm going to defer this to some later v2.x release, with potential for removing the old interface in v3.x
Way back in 2012, 016d66c changed the
::[]
API to act as both a command and query, in a decision based on pragmatism. At the time, @bmabey noted his dislike for this, and his desire to deprecate it. Now that we're talking about a v2.0 release, I think this is a good time to talk about improving this situation in a backwards-incompatible way.I have an alternative API proposal that I've been exploring, which splits the
::[]
method into::[]
for queries, and::[]=
for commands. Complex configuration is also simplified to a hash, or array of hashes:I have been working on a document exploring what this API change would look like for DatabaseCleaner's many different use-cases, ranging from the most simplistic all the way up to very complex multiple ORM and database configuration, and this seems like this could work well, while also simplifying internals. I haven't prototyped it yet to confirm, but I even think its possible to add API this to the 1.x series in a backwards-compatible way, which would ease the v2.0 transition.
However, I want to get some feedback on this general direction before going too deep down the rabbit hole. Perhaps there is already an alternative API that you folks have in mind? Or perhaps we don't want to change the API at all at this point? But if this API looks promising, I'll post the document, and we can go from there!
The text was updated successfully, but these errors were encountered: