Skip to content

@inossidabile /gist:4015836
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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
@michaelbaudino

Hi, thanks for the tip. Watch out, though : master (1.0.x.pre) branch now uses params["q"]["#{field}_lteq"] (notice the ending 'q').

@NayanaBhagat

Should we create a new file called ResourceDSL for this?

@mrjman

The solutions mentioned in activeadmin/activeadmin#3529 by chrp and keithlayne work great and are a little cleaner in my opinion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.