filtrar los params tambien al crear :/

This commit is contained in:
f 2018-07-27 11:22:08 -03:00
parent 4a66a3ca35
commit b76ac00206
No known key found for this signature in database
GPG key ID: F3FDAB97B5F9F7E7

View file

@ -35,7 +35,7 @@ class PostsController < ApplicationController
@lang = find_lang(@site) @lang = find_lang(@site)
@template = find_template(@site) @template = find_template(@site)
@post = Post.new(site: @site, lang: @lang, template: @template) @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 if @post.save
redirect_to site_posts_path(@site, lang: @lang) redirect_to site_posts_path(@site, lang: @lang)
@ -79,7 +79,7 @@ class PostsController < ApplicationController
repair_nested_params(value) repair_nested_params(value)
else else
obj[key] = value.values obj[key] = value.values
value.values.each {|h| repair_nested_params(h) } obj[key].each {|h| repair_nested_params(h) }
end end
end end
end end