Closed yahor closed 5 months ago
Attention: 2 lines
in your changes are missing coverage. Please review.
Comparison is base (
c46f844
) 57.64% compared to head (f8c3f22
) 58.01%.
Files | Patch % | Lines |
---|---|---|
app/controllers/admin/users_controller.rb | 0.00% | 2 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Does Ruby have a constructor to initialize default values?
@abitrolly Ruby - yes. def initialize
In Rails we use callback with condition after_initialize :set_default_tariff, if: :new_record?
I found this post https://itecnote.com/tecnote/rails-how-to-set-default-values-in-activerecord/ which uses universal init
method for setting defaults, and it is called unconditionally.
Why it is not possible to specify defaults on a model level?
606