Skip to content

Commit

Permalink
add implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
caiohsramos authored and Anil Kumar Maurya committed Mar 25, 2021
1 parent baddd13 commit ca5bbfc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/aasm/persistence/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,14 @@ class Base
# make sure to create a (named) scope for each state
def state_with_scope(*args)
names = state_without_scope(*args)
names.each { |name| create_scope(name) if create_scope?(name) }
names.each do |name|
if namespace?
# Create default scopes even when namespace? for backward compatibility
namepaced_name = "#{namespace}_#{name}"
create_scope(namepaced_name) if create_scope?(namepaced_name)
end
create_scope(name) if create_scope?(name)
end
end
alias_method :state_without_scope, :state
alias_method :state, :state_with_scope
Expand Down

0 comments on commit ca5bbfc

Please sign in to comment.