From 97b2f7c87dd7d58b41fc93d7660713b4cf1201fc Mon Sep 17 00:00:00 2001 From: f Date: Fri, 20 Jul 2018 15:57:14 -0300 Subject: [PATCH] mas efectos secundario de get_front_matter --- app/models/post.rb | 2 +- app/views/posts/_form.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/post.rb b/app/models/post.rb index c922ebdc..0541f664 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -278,7 +278,7 @@ class Post # Obtiene metadatos de forma recursiva def get_front_matter(name) - name = name.to_s if name.is_a? Symbol + name = name.to_s unless name.is_a? Array @front_matter.dig(*name) end diff --git a/app/views/posts/_form.haml b/app/views/posts/_form.haml index 8a5a483e..8816b604 100644 --- a/app/views/posts/_form.haml +++ b/app/views/posts/_form.haml @@ -86,7 +86,7 @@ -# Genera todos los campos de la plantilla - @post.template_fields.each do |template| - next unless type = template.type - - value = @post.new? ? template.values : @post.get_front_matter(template) + - value = @post.new? ? template.values : @post.get_front_matter(template.key) .form-group = label_tag "post_#{template}", id: template do = link_to '#' + template.key, class: 'text-muted',