aasm
aasm copied to clipboard
Whiny_persistence should be true as default
Is your feature request related to a problem? Please describe. I wasn't aware that the events with bangs didn't raise an error when validation fails.
This is unconsistent with ActiveRecord methods' behaviour.
Describe the solution you'd like
- Whiny_persistence's default value should be true
- It should be possible to change the defaults application-wide in an initializer.
Describe alternatives you've considered Doesn't apply
Sounds like you're using Rails. As a workaround, I wrote an ActiveSupport::Concern
for this that seems to work well enough
# AASM + extensions
# You should ONLY `include` this module since it `include`s AASM directly
module AasmExtensions
extend ActiveSupport::Concern
included do
# These parameters should be shared by all AASM instances
# i.e. aasm(..., **AASM_ARGS) do ... end
AASM_ARGS = {
logger: Rails.logger,
whiny_persistence: true
}
include AASM
end
end
As noted, you can then use aasm(..., **AASM_ARGS) do ... end
on all your state machines.
Also apparently a PR for your first request has been open for a long time https://github.com/aasm/aasm/pull/378