From b76ac00206f91318c421a3c3fc2c51f0de9b8624 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 27 Jul 2018 11:22:08 -0300 Subject: [PATCH] filtrar los params tambien al crear :/ --- app/controllers/posts_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 480f6007..e1b137b5 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -35,7 +35,7 @@ class PostsController < ApplicationController @lang = find_lang(@site) @template = find_template(@site) @post = Post.new(site: @site, lang: @lang, template: @template) - @post.update_attributes(post_params) + @post.update_attributes(repair_nested_params(post_params)) if @post.save redirect_to site_posts_path(@site, lang: @lang) @@ -79,7 +79,7 @@ class PostsController < ApplicationController repair_nested_params(value) else obj[key] = value.values - value.values.each {|h| repair_nested_params(h) } + obj[key].each {|h| repair_nested_params(h) } end end end