On Wednesday, June 26, 2019 at 5:41:15 PM UTC-7, lkfken wrote:
>
> Hi,
>
> I have a very simple record
>
> policy_number = 'P000031206'
>
>
> ccsb_group_record = EdiShop::ShopGroupCrosswalk.where(:policynumber =>
> policy_number).first
> # #<EdiShop::ShopGroupCrosswalk @values={:policynumber=>"P000031206",
> :group_id=>"M10050", :orig_eff_dt=>2014-07-01 00:00:00 -0700,
> :eff_dt=>2019-07-01 00:00:00 -0700, :renew_dt=>2020-07-01 00:00:00 -0700}>
>
> ccsb_group_record.eff_dt = Date.civil(2020,7,1)
> #<EdiShop::ShopGroupCrosswalk @values={:policynumber=>"P000031206",
> :group_id=>"M10050", :orig_eff_dt=>2014-07-01 00:00:00 -0700,
> :eff_dt=>2020-07-01 00:00:00 -0700, :renew_dt=>2020-07-01 00:00:00 -0700}>
>
> ccsb_group_record.save
> # Sequel::NoExistingObject: Attempt to update object did not result in a
> single row modification (SQL: UPDATE TOP (1)
> [EDI_SHOP].[DBO].[GROUP_CROSSWALK] SET [POLICYNUMBER] = N'P000031206',
> [GROUP_ID] = N'M10050', [ORIG_EFF_DT] = '2014-07-01T00:00:00.000', [EFF_DT] =
> '2020-07-01T00:00:00.000', [RENEW_DT] = '2020-07-01T00:00:00.000' WHERE
> ([POLICYNUMBER] IS NULL))
>
> I don't understand where is WHERE ([POLICYNUMBER] IS NULL)) coming from. How
> can I fix update this record besides using the class method below?
>
>
I don't understand either, since it appears the policynumber value
is P000031206. It could be that one of the hooks is unsetting the value.
However, that is just a guess as the example you provided is not self
contained. Can you put together a minimal, self contained example showing
the problem? The example should create the database table, then create the
model class, and then have the code that shows the failure.
> EdiShop::ShopGroupCrosswalk.where(:policynumber =>
> policy_number).update(eff_dt: Date.civil(2020,7,1))
>
>
Note that this isn't the same thing. This calls Dataset#update, which
doesn't run hooks, validations, etc.
Thanks,
Jeremy
>
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sequel-talk/086fc188-1003-4416-a32d-e5748df4a609%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.