Skip to content

Commit

Permalink
transparent scope
Browse files Browse the repository at this point in the history
allow to chain scopes and scopes are transparent if no values are given to it.

fix state-machines#66
  • Loading branch information
gagalago authored and diegotoral committed Apr 17, 2021
1 parent fbd7d47 commit 607d0ec
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/state_machines/integrations/active_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ def locale_path

# Defines a new named scope with the given name
def create_scope(name, scope)
lambda { |model, values| model.where(scope.call(values)) }
lambda { |model, values| model.where(scope.call(values)) if values.present? }
end

# ActiveModel's use of method_missing / respond_to for attribute methods
Expand Down

0 comments on commit 607d0ec

Please sign in to comment.