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 #increment! and #decrement! methods to behave similarly to the Rails' ActiveRecord methods #624

Merged
merged 8 commits into from Jan 9, 2023

Conversation

andrykonchin
Copy link
Member

@andrykonchin andrykonchin commented Jan 8, 2023

Changes:

  • #increment!/#decrement!:
    • returns self, not boolean
    • saves only the attribute new value, not other modified attributes
    • skips callbacks and validation
    • does not reload a model
    • support a :touch option (similar to the Rails' increment! and #decrement! methods that is described here)
  • .inc
    • support the :touch option similar to the equivalent Rails' method .update_counters
  • fix CI for Ruby 2.3-2.5 and use default RubyGems and Bundler versions (see Ruby 2.3 to 2.5 - cannot update RubyGems ruby/setup-ruby#441)

Related links:

@codecov
Copy link

codecov bot commented Jan 8, 2023

Codecov Report

Merging #624 (f423a3d) into master (6e2b56b) will increase coverage by 0.09%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #624      +/-   ##
==========================================
+ Coverage   90.06%   90.15%   +0.09%     
==========================================
  Files          59       60       +1     
  Lines        3020     3048      +28     
==========================================
+ Hits         2720     2748      +28     
  Misses        300      300              
Impacted Files Coverage Δ
lib/dynamoid/persistence.rb 98.07% <100.00%> (-0.10%) ⬇️
lib/dynamoid/persistence/inc.rb 100.00% <100.00%> (ø)

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

Changes:
- returns self, not boolean
- saves only the attribute new value, not other modified attributes
- skips callbacks and validation
- does not reload a model
@andrykonchin andrykonchin force-pushed the fix-increment-and-decrement-with-bang branch 2 times, most recently from ad2e636 to c697418 Compare January 8, 2023 22:53
@andrykonchin andrykonchin force-pushed the fix-increment-and-decrement-with-bang branch from c697418 to f423a3d Compare January 8, 2023 22:56
@github-actions
Copy link

github-actions bot commented Jan 8, 2023

Code Coverage

Package Line Rate Health
dynamoid 90%
Summary 90% (2748 / 3048)

Minimum allowed line rate is 90%

@andrykonchin andrykonchin marked this pull request as ready for review January 8, 2023 23:03
@andrykonchin andrykonchin merged commit 0df1e6f into master Jan 9, 2023
@andrykonchin andrykonchin deleted the fix-increment-and-decrement-with-bang branch January 9, 2023 21:55
@andrykonchin andrykonchin changed the title Fix #increment! and #decrement! methods to behave similar to the Rails' ActiveRecord methods Fix #increment! and #decrement! methods to behave similarly to the Rails' ActiveRecord methods Jan 28, 2023
@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.

None yet

1 participant