Class: Effective::Datatables::Orders

Inherits:
Effective::Datatable
  • Object
show all
Defined in:
app/models/effective/datatables/orders.rb

Instance Method Summary collapse

Instance Method Details

#collectionObject



34
35
36
37
38
39
40
# File 'app/models/effective/datatables/orders.rb', line 34

def collection
  if attributes[:user_id].present?
    Effective::Order.purchased.where(:user_id => attributes[:user_id]).includes(:user).includes(:order_items)
  else
    Effective::Order.purchased.includes(:user).includes(:order_items)
  end
end

#search_column(collection, table_column, search_term) ⇒ Object



42
43
44
45
46
47
48
# File 'app/models/effective/datatables/orders.rb', line 42

def search_column(collection, table_column, search_term)
  if table_column[:name] == 'id'
    collection.where(:id => search_term)
  else
    super
  end
end