Skip to content

Instantly share code, notes, and snippets.

@tk0miya
Created June 12, 2022 08:54
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 tk0miya/9e52a84c64ca1604aeed64fbe14489f2 to your computer and use it in GitHub Desktop.
Save tk0miya/9e52a84c64ca1604aeed64fbe14489f2 to your computer and use it in GitHub Desktop.
# frozen_string_literal: true
# ActiveYaml の association を Ransack で検索可能にする
module ActiveHash
module Ransackable
def ransackable_attributes(_auth_object = nil)
data.first.keys
end
def ransortable_attributes(auth_object = nil)
ransackable_attributes(auth_object)
end
def ransackable_associations(_auth_object = nil)
[]
end
def klass
self
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment