format idAttribute on save/delete (#1676) #1680
Conversation
I'll give a round on this, although, we could move the format up a bit instead of running it twice, even for a single key, it looks harder to read than it'd be with a single call. |
Lost you there, you mean just to do it in two lines instead of one, or create a more reusable method and call it from there? LMK - I'll comply |
P.S - I met more bugs around the same problem which appears in different places around delete and updates, although I'm yet sure if the root cause is in Bookshelf itself, or in I tend to go for creating a method that provides a selector/filter/where clause that should be used wherever a key to a table is needed. Not just a private function, but a part of the API. |
anything? |
I'm not that sure about increasing our dependency on |
This is very similar to #1338. Can you explain why your solution is better? Also, can you provide test cases for the issues this fixes? |
Yup. looks very similar. I think mine uses less operations, but it's so negligible that it doesn't worth the discussion. |
Great. This just needs a test case then and I'll merge it. |
I hear you.
I'll find time for it soon...
…On Tue, Feb 6, 2018 at 8:06 PM, Ricardo Graça ***@***.***> wrote:
***@***.**** requested changes on this pull request.
Great. This just needs a test case then and I'll merge it.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1680 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAxBHTJYDWiob8l30RHVrObLl5hlbK2dks5tSJSfgaJpZM4QPVXz>
.
|
ok, done. There you go Updated: Sorry it took so long, I misread the picture... |
@ricardograca |
@osher Sorry, I'll take a look later today. Currently busy with something else. |
+1 |
format idAttribute on save/delete (#1676)
Introduction
Working with a DB and Web that do not agree on field-names conventions - trying to leverage
Model#format()
andModel#parse()
worked for selects and inserts - but fails for udpates and deletes.Motivation
This PR fixes that. Closes #1676, Closes #1338.
Proposed solution
use
Model#format
to transform the id attribute name passed to .where in delete and update operations.Current PR Issues
none
Alternatives considered
none