Created
February 14, 2014 22:47
-
-
Save benjaminwood/9011123 to your computer and use it in GitHub Desktop.
# Active admin relies on a method "boolean_checked?" that is part of a newer version of formtastic that we cannot upgrade to because of surveyor compatibility. This is an initializer monkey patch.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActiveAdmin | |
module Inputs | |
class FilterBooleanInput < ::Formtastic::Inputs::BooleanInput | |
def boolean_checked?(value, checked_value) | |
case value | |
when TrueClass, FalseClass | |
value | |
when NilClass | |
false | |
when Integer | |
value != 0 | |
when String | |
value == checked_value | |
when Array | |
value.include?(checked_value) | |
else | |
value.to_i != 0 | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment