Module: Guts::NavigatableConcern

Extended by:
ActiveSupport::Concern
Included in:
Category, Content, Type
Defined in:
app/concerns/guts/navigatable_concern.rb

Overview

This concern allows for a model to be “navigatable” in the admin panel for use with developing menu links

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

Note:

This method uses instance_eval to get the instance variables.. :title to self.title, :type.title to self.type.title

Renders a string based on options from the model

Returns:

  • (String)

    compiled string based on format and variables

See Also:



12
13
14
15
16
17
18
19
# File 'app/concerns/guts/navigatable_concern.rb', line 12

def navigatable_format
  formatted = self.class.navigatable_opts[:format]
  self.class.navigatable_opts[:variables].each do |var|
    formatted = formatted.gsub(/\:#{var}/, instance_eval("self.#{var}"))
  end
  
  formatted
end