Module: Models::SearchableViewWithRmaItems::ClassMethods

Defined in:
app/concerns/models/searchable_view_with_rma_items.rb

Instance Method Summary collapse

Instance Method Details

#clean_array_params(params) ⇒ Object



13
14
15
# File 'app/concerns/models/searchable_view_with_rma_items.rb', line 13

def clean_array_params(params)
  [params].flatten.compact.uniq.map(&:to_i)
end

#ransackable_scopes(_auth_object = nil) ⇒ Object

Expose contains_rma_item_ids to Ransack so it is accepted in both lenient
and strict (ignore_unknown_conditions: false) probe mode.



9
10
11
# File 'app/concerns/models/searchable_view_with_rma_items.rb', line 9

def ransackable_scopes(_auth_object = nil)
  super + %i[contains_rma_item_ids]
end

#rma_item_sql_checkObject



17
18
19
20
21
22
23
24
25
# File 'app/concerns/models/searchable_view_with_rma_items.rb', line 17

def rma_item_sql_check
  %{
  EXISTS (select 1
          from rma_items ri
          where
            ri.rma_id = #{table_name}.id
            and ri.returned_item_id IN (?))
  }
end