https://avo.cool logo
composite primary_keys
# general
e
Hey hey 👋 Is there an example of a filter that has a simple query between 2 dates? Sounds like a common use-case but can't find any example in the docs.
l
Hello @early-leather-2501 it can be achieved with dynamic filters
Demo: https://main.avodemo.com/avo/resources/users?filters[birthday][is_within][]=2020-03-27%20to%202020-03-30
you just need to add
filterable: true
to the date field
e
🤯
l
Ah and don't forget to allow ransack to search on it by adding (on the model)
Copy code
ruby
  def self.ransackable_attributes(auth_object = nil)
    ["status", "stage", "country"]
  end
  #OR
  def self.ransackable_attributes(auth_object = nil)
    authorizable_ransackable_attributes
  end
e
Works like a charm! Thanks!
l
Coool 😎 , anytime!
2 Views