Skip to content

Instantly share code, notes, and snippets.

@brianpattison
Last active December 22, 2015 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianpattison/8bb0b682b756a3d849aa to your computer and use it in GitHub Desktop.
Save brianpattison/8bb0b682b756a3d849aa to your computer and use it in GitHub Desktop.
JSON API Resources Filtering
filter :before, apply: -> (records, value, _options) do
records.where("shop_orders.order_datetime < ?", value)
end
filter :after, apply: -> (records, value, _options) do
records.where("shop_orders.order_datetime > ?", value)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment