diff --git a/app/models/metadata_file.rb b/app/models/metadata_file.rb index 3ac89c9b..61aea897 100644 --- a/app/models/metadata_file.rb +++ b/app/models/metadata_file.rb @@ -49,6 +49,8 @@ class MetadataFile < MetadataTemplate value['path'] = relative_destination_path_with_filename.to_s if static_file end + self[:value] = self[:value].to_h + true end diff --git a/app/models/post.rb b/app/models/post.rb index 053c995f..6f47a1bb 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -193,7 +193,7 @@ class Post # Limpiar el nombre del atributo, para que todos los ayudantes # reciban el método en limpio unless attribute? name - raise UnknownAttributeError, I18n.t('exceptions.post.no_method', method: name) + raise NoMethodError, I18n.t('exceptions.post.no_method', method: name) end define_singleton_method(name) do diff --git a/app/services/post_service.rb b/app/services/post_service.rb index 90aa9401..84f58dad 100644 --- a/app/services/post_service.rb +++ b/app/services/post_service.rb @@ -19,9 +19,10 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do # Crea los posts anidados create_nested_posts! post, params[:post] + post.save update_related_posts - commit(action: :created, add: files) if post.save + commit(action: :created, add: files) update_site_license!