Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix callbacks #634

Merged
merged 5 commits into from
Feb 15, 2023
Merged

Fix callbacks #634

merged 5 commits into from
Feb 15, 2023

Conversation

andrykonchin
Copy link
Member

@andrykonchin andrykonchin commented Feb 14, 2023

Reviewed callbacks and fixed Rails compatibility issues:

  • fixed order of save and create/update callbacks
  • removed before_/around_ initialize callback
  • run after_touch callback in #touch, #increment! and #decrement! methods

Also there are the following fixes of the #touch method:

  • it doesn't save other modified attributes - only timestamps
  • it doesn't perform validation and doesn't execute save/create/update callbacks
  • it accepts not one attribute name but a list of names
  • it accepts a :time option with timestamp value

@codecov
Copy link

codecov bot commented Feb 14, 2023

Codecov Report

Merging #634 (dc0e88a) into master (1f09be1) will increase coverage by 0.02%.
The diff coverage is 100.00%.

❗ Current head dc0e88a differs from pull request most recent head fbb690e. Consider uploading reports for the commit fbb690e to get more accurate results

@@            Coverage Diff             @@
##           master     #634      +/-   ##
==========================================
+ Coverage   90.24%   90.27%   +0.02%     
==========================================
  Files          61       61              
  Lines        3127     3136       +9     
==========================================
+ Hits         2822     2831       +9     
  Misses        305      305              
Impacted Files Coverage Δ
lib/dynamoid/components.rb 100.00% <100.00%> (ø)
lib/dynamoid/persistence.rb 98.15% <100.00%> (+0.09%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Add specs for the following methods:
- #save
- #update_attributes!
- #update_attribute
- #update
- #destroy
- .create!
- .update!
The save callback is outer for the create/update ones.
Changes:
- accept :time option
- accept several attribute names
- call :touch callbacks
@github-actions
Copy link

Code Coverage

Package Line Rate Health
dynamoid 90%
Summary 90% (2831 / 3136)

Minimum allowed line rate is 90%

@andrykonchin andrykonchin merged commit c280f2d into master Feb 15, 2023
@andrykonchin andrykonchin deleted the fix-callbacks branch February 15, 2023 20:23
@andrykonchin andrykonchin restored the fix-callbacks branch April 11, 2023 23:47
@andrykonchin andrykonchin added this to the v3.9.0 milestone Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant