无法访问来自ckeditor gem的嵌套参数

时间:2019-06-26 23:15:52

标签: ruby-on-rails ruby-on-rails-5 ckeditor4.x

我正在尝试访问由ckeditor gem放入的嵌套参数。我似乎无法找到他们。我可以访问其他嵌套参数。

这是我的参数:

    {"utf8"=>"✓",
 "authenticity_token"=>"token==",
 "task"=>
  {"subject"=>"(Quote Requested) LT Quote",
   "description"=>"For sample",
   "problem_on"=>"2019 June 21",
   "due_on"=>"2019 June 28",
   "job_id"=>"121",
   "lmi_host_id"=>"0",
   "assigned_to_id"=>"104",
   "priority"=>"Medium",
   "task_class_id"=>"2"},
 "task_template"=>{"title"=>""},
 "note"=>{"{:class=>\"notes\", :ckeditor=>{:language=>\"us\"}}"=>"<p>test test<strong>setset<em>testste</em></strong></p>\r\n"},
 "bill_hours"=>"0",
 "bill_minutes"=>"0",
 "nonbill_hours"=>"0",
 "nonbill_minutes"=>"0",
 "cat_type_id"=>"",
 "activity"=>{"location_id"=>"", "location_modifier_id"=>"", "review"=>"0", "telecommute"=>"0"},
 "commit"=>"Submit",
 "id"=>"172330"}

我可以访问

  

params [:activity] [:location_id]   和   params [:task] [:subject]   作为例子。

当我尝试访问

下的任何内容时
  

params [:note]

我归零了。

  

params [:note]

返回以下内容:

<ActionController::Parameters {"{:class=>\"notes\", :ckeditor=>{:language=>\"us\"}}"=>"<p>test test<strong>setset<em>testste</em></strong></p>\r\n"} permitted: true>

我需要找到一种方法来使<p>test test<strong>setset<em>testste</em></strong></p>\r\n脱离参数

感谢您的帮助!

1 个答案:

答案 0 :(得分:1)

问题出在客户端

{"{:class=>\"notes\", :ckeditor=>{:language=>\"us\"}}"=>"<p>test test<strong>setset<em>testste</em></strong></p>\r\n"}

看起来很奇怪,因为这是访问所需值的键"{:class=>\"notes\", :ckeditor=>{:language=>\"us\"}}"! 我认为您需要检查客户端为什么会这样发送