Open ches opened 12 years ago
but it should be trivial to try get first instead of as a rescue for create! I think
Sure! I don't have a strong opinion on this one so I'm happy for you to change this behaviour. :)
the stores that seem like the ideal targets (Redis and Mongo come to mind) have native Set data structures, which would be ideal to use
I agree. Though we might not need those datastores anytime soon. I imagined that we could rely on AR for quite a while, especially when I get the pagination sorted. :)
It's pretty icky to rely on unique indexes IMO, and a manifest symptom is a Rails log littered with transaction rollbacks. I know
orm_adapter
doesn't explicitly providefind_or_create
(it would be unreasonable for it to support dynamic finders, after all), but it should be trivial to tryget
first instead of as arescue
forcreate!
I think.Thoughts? I could whip up a pull request with updated tests, but thought I'd make sure you're amenable to the idea first.
Pluggable persistence backends is a great goal to have for this, but in the long run I wonder if
orm_adapter
is really going to be of much use -- the stores that seem like the ideal targets (Redis and Mongo come to mind) have native Set data structures, which would be ideal to use.