Module: Guts::NavigatableConcern
- Extended by:
- ActiveSupport::Concern
- 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
-
#navigatable_format ⇒ String
Renders a string based on options from the model.
Instance Method Details
#navigatable_format ⇒ String
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
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 |