app/models/concerns/landable/has_templates.rb in landable-1.13.1 vs app/models/concerns/landable/has_templates.rb in landable-1.13.2

- old
+ new

@@ -21,40 +21,39 @@ def templates Landable::Template.where(slug: template_names) end # passthrough for body=; clears the template_names cache in the process - def body= body_val + def body=(body_val) @template_slug = nil @asset_names = nil self[:body] = body_val end # this looks weird; I swear it works def save_templates! - self.templates = self.templates + self.templates = templates end private - def template_names_for_node node, names = [] + def template_names_for_node(node, names = []) # set up a recursing function to search for template tags if node.is_a? Landable::Liquid::TemplateTag names << node.template_slug unless names.include? node.template_slug end - if node.respond_to? :nodelist and node.nodelist - node.nodelist.each { |node| template_names_for_node node, names } + if node.respond_to?(:nodelist) && node.nodelist + node.nodelist.each { |n| template_names_for_node n, names } end names end - end module ClassMethods def templates_join_table_name - "#{Landable.configuration.database_schema_prefix}landable.#{self.name.underscore.split('/').last}_templates" + "#{Landable.configuration.database_schema_prefix}landable.#{name.underscore.split('/').last}_templates" end end end end