Skip to content

Commit

Permalink
Add automatic not scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
danielricecodes committed Sep 13, 2022
1 parent bf7ff4c commit 598dc22
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/aasm/persistence/active_record_persistence.rb
Expand Up @@ -45,6 +45,7 @@ def aasm_create_scope(state_machine_name, scope_name)
conditions = { aasm(state_machine_name).attribute_name => scope_name.to_s }
class_eval do
scope scope_name, lambda { where(table_name => conditions) }
scope "not_#{scope_name}", lambda { where.not(table_name => conditions) }
end
else
conditions = {
Expand Down

0 comments on commit 598dc22

Please sign in to comment.