Issue with Strong Parameters??
I love this gem and have successfully used it for several years. For some reason, I just started getting this error:
ActionController::UnpermittedParameters in Admin::PostsController#create
I tried adding :_wysithml5_mode as a permitted param, but that did not work.
I'm running:
activeadmin 1.0.0.pre2 Rails 4.2.4 Ruby 2.2.3
Thanks in advance.
What parameters are you sending?
I'm loading this up in a similar configuration as we speak. I'll touch back with what I find.
Reporting back:
I can't reproduce this out of the box. Here are the parameters I'm sending,
Parameters: {"utf8"=>"✓", "authenticity_token"=>"YaNEO9yK5082BhkcPZvwnxhffhUZjyV9+RgoFs5j8mwA08EdGMKEXEz7gMX8Ws62BmXdacDajv6KQ0l4TOqEwQ==", "news_item"=>{"title"=>"cool man bro", "content"=>"<p>asdf</p>", "donators"=>"1"}, "_wysihtml5_mode"=>"1", "commit"=>"Create News item"}
I don't think you'll need to pass _wysihtml5_mode as a param unless I'm missing something very obvious.
Sorry for the delayed reply. I am sending the following:
{"utf8"=>"✓",
"authenticity_token"=>"96WVpfxuZyqHvWlkNUuznYoyS/zal1xy2nrTM6SEi4yqJILK6UWKKCuTYXGWmmCH4UYUAUPwzB4ZUlh3WoqmSg==",
"post"=>{"author"=>"test author",
"title"=>"test title",
"body"=>"<p>test rich text editor</p>"},
"_wysihtml5_mode"=>"1",
"commit"=>"Create Post"}
I get this error:
ActiveSupport::Notifications.instrument(name, keys: unpermitted_keys)
when :raise
raise ActionController::UnpermittedParameters.new(unpermitted_keys)
end
end
end
+1 on this. Works perfectly on one of my apps but error just started appearing on the other.
Anyone have another solution for this? Another HTML editor for AA? This is a blocker for me.
This workaround works.
module ActiveAdmin
class ResourceDSL < DSL
def permit_params(*args, &block)
resource_sym = config.resource_name.singular.to_sym
controller do
define_method :permitted_params do
params.permit :_method, :_wysihtml5_mode, :authenticity_token, :commit, :id, :utf8,
resource_sym =>
block ? instance_exec(&block) : args
end
end
end
end
end