Skip to content

Instantly share code, notes, and snippets.

@orendon
Forked from inossidabile/gist:4015836
Last active December 25, 2015 07:48
Show Gist options
  • Save orendon/6941501 to your computer and use it in GitHub Desktop.
Save orendon/6941501 to your computer and use it in GitHub Desktop.
module ActiveAdmin
class ResourceDSL
def filter(*args)
field = args[0]
klass = @config.resource_class_name.constantize
type = klass.columns.select{|c| c.name == field.to_s}.first.try(:type)
if type == :datetime
controller do
before_filter :only => :index do
if !params["q"].blank? && !params["q"]["#{field}_lte"].blank?
params["q"]["#{field}_lte"] += " 23:59:59.999999"
end
end
end
end
super
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment