You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
My class and dsl would be cleaner if it were possible to add custom dsl and options to event and transition blocks.
For ex
aasm do
....
event :start, metadata: { priority: 0 } do
requires_arguments :user_id, :reason
transition from: :idle, to: :running do
metadata: priority: 1
end
end
...
Describe the solution you'd like
For a custom subclass of AASM::Base to be able to set the sub-class of AASM::Core::State, Event and Transition to instantiate. At a quick glance it looks like it would also be necessary to make a way to customize the valid_keys lists passed to add_options_from_dsl
Describe alternatives you've considered
It is possible to implement the features directly in the implementing class but it quickly gets messy. For ex
aasm do
...
event :start do
before ->(**args) { check_arguments!(args, [:user_id, :reason]) }
...
end # aasm
def check_arguments!(args, required_keys)
raise "Missing arguments" unless (required_keys - args.keys).blank?
end
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
My class and dsl would be cleaner if it were possible to add custom dsl and options to event and transition blocks.
For ex
Describe the solution you'd like
For a custom subclass of AASM::Base to be able to set the sub-class of
AASM::Core::State
,Event
andTransition
to instantiate. At a quick glance it looks like it would also be necessary to make a way to customize thevalid_keys
lists passed toadd_options_from_dsl
Describe alternatives you've considered
It is possible to implement the features directly in the implementing class but it quickly gets messy. For ex
The text was updated successfully, but these errors were encountered: