Class: List

Inherits:
ApplicationRecord show all
Includes:
CaberObject, PublicIDable
Defined in:
app/models/list.rb

Constant Summary collapse

SUPPORTED_ITEM_TYPES =
%w[Model]

Constants inherited from ApplicationRecord

ApplicationRecord::SAFE_NAME_LENGTH

Instance Method Summary collapse

Methods included from PublicIDable

#to_param

Methods included from CaberObject

#just_became_public?, #matching_permission_preset, #owners, #private?, #public?, #set_default_permission_preset, #set_owner, #set_permissions_from_preset, #will_be_public?

Methods inherited from ApplicationRecord

find_param

Instance Method Details

#reject_list_items_attributes(item) ⇒ Object



21
22
23
24
25
26
27
28
# File 'app/models/list.rb', line 21

def reject_list_items_attributes(item)
  # Reject blank
  return true if item.all? { |key, value| key == "_destroy" || value.blank? }
  # Reject anything that's not a supported type
  return true unless item["listable_type"].in?(SUPPORTED_ITEM_TYPES)
  # Well, alrighty then
  false
end