1
0
Fork 0
mirror of https://github.com/aasm/aasm synced 2023-03-27 23:22:41 -04:00

Create named scope for each state name #365

This commit is contained in:
Eugene Haisenka 2016-09-17 13:15:54 +03:00
parent c73f883e1c
commit 7ba401b991

View file

@ -53,9 +53,9 @@ module AASM
class Base
# make sure to create a (named) scope for each state
def state_with_scope(name, *args)
state_without_scope(name, *args)
create_scope(name) if create_scope?(name)
def state_with_scope(*args)
names = state_without_scope(*args)
names.each { |name| create_scope(name) if create_scope?(name) }
end
alias_method :state_without_scope, :state
alias_method :state, :state_with_scope