Sha256: 990943bae0bf724dcf8a29a19628ef4769d54258702f14198d81349d895aa1ee
Contents?: true
Size: 1 KB
Versions: 14
Compression:
Stored size: 1 KB
Contents
# frozen_string_literal: true class Avo::Index::ResourceTableComponent < ViewComponent::Base include Avo::ApplicationHelper attr_reader :pagy, :query def initialize(resources: nil, resource: nil, reflection: nil, parent_record: nil, parent_resource: nil, pagy: nil, query: nil, actions: nil) @resources = resources @resource = resource @reflection = reflection @parent_record = parent_record @parent_resource = parent_resource @pagy = pagy @query = query @actions = actions end def encrypted_query # TODO: move this to the resource where we can apply the adapter pattern serialized_query = if query.instance_of?(Ransack::Search) query.context.object.to_sql else return :select_all_disabled if query.nil? || !query.respond_to?(:all) || !query.all.respond_to?(:to_sql) query.all.to_sql end return if serialized_query.nil? Avo::Services::EncryptionService.encrypt( message: serialized_query, purpose: :select_all ) end end
Version data entries
14 entries across 14 versions & 1 rubygems