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 Dec 5, 2017
1 parent daec4b5 commit 049ef73
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 @@ -565,7 +565,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 049ef73

Please sign in to comment.