heartcombo/has_scope

scope with params `false` does not call boolean scope with type: :boolean and allow_blank

fluxsaas opened this issue · 1 comments

Hey,

if i define a scope with:

has_scope :active, type: :boolean, allow_blank: true

and pass the param "active"=>"false" the scope 'active' does not get invoked.

current workaround:

has_scope :active
  # has_scope does not call `false` scope properly when set with
  # as: :boolean, allow_blank: true
  scope :active, lambda { |value|
    value = ActiveRecord::ConnectionAdapters::Column.value_to_boolean(value)
    where(active: value)
  }
  • rails 4.1.6
  • has_scope (0.5.1)

Please test with the master branch, it contains #55 to fix this.

We'll work on a release soon, please let us know if everything worked fine. Thanks.