0

config.filter_parameters += [:password, :efile, :title]在 application.rb 中有这一行。
但是当我尝试保存这样的模型时:

 @claim_db[:xml] = xml_builder.to_xml.gsub('utf-8', 'utf-16')
 @claim_db[:title] = title.present? ? title : nil
 @claim_db[:applicants] = applicants.present? ? applicants : nil
 @claim_db[:native_number] = nn.present? ? nn : nil
 @claim_db[:change_date] = Time.now
 @claim_db[:is_signed] = false
 @claim_db[:with_errors] = errors.count > 0
 @claim_db.save!

在日志中获取:

  ←[1m←[36mAREL (2.0ms)←[0m  ←[1mINSERT INTO [edocs] ([eclaim_id], [materialtitl
e_id], [is_secondary], [title], [ext], [size], [code], [receive_date], [reg_date
], [reg_numb], [idcead], [efile]) VALUES (100003, 7, 0, N'test', N'rtf', 4, N'test', '2012-05-11 21:05:12
.125', NULL, NULL, NULL, 0x61737373)←[0m
  ←[1m←[35mEXECUTE (0.0ms)←[0m  COMMIT TRANSACTION

我该如何解决?

4

1 回答 1

3

此配置设置用于参数记录 - 当您使用 params 散列访问控制器时,这些将从日志中的散列中省略。在生产模式下,不会记录您的 SQL 查询。

于 2012-05-11T18:41:01.193 回答