Class: Comable::NavigationItem

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Linkable
Defined in:
app/models/comable/navigation_item.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.linkable_id_options(type) ⇒ Object


25
26
27
28
# File 'app/models/comable/navigation_item.rb', line 25

def linkable_id_options(type)
  params = linkable_params(type)
  params ? params[:linkable_id_options] : [[]]
end

.linkable_params_listsObject


17
18
19
20
21
22
23
# File 'app/models/comable/navigation_item.rb', line 17

def linkable_params_lists
  [
    web_address_linkable_params, # Web Address
    product_linkable_params,     # Product
    page_linkable_params         # Page
  ].compact
end

Instance Method Details

#linkable_classObject


63
64
65
# File 'app/models/comable/navigation_item.rb', line 63

def linkable_class
  linkable_type.constantize if linkable_type.present?
end

#linkable_exists?Boolean

Returns:

  • (Boolean)

71
72
73
# File 'app/models/comable/navigation_item.rb', line 71

def linkable_exists?
  linkable_id_options.all?(&:present?)
end

#linkable_id_optionsObject


67
68
69
# File 'app/models/comable/navigation_item.rb', line 67

def linkable_id_options
  self.class.linkable_id_options(linkable_type)
end