to_sql 不适用于 update_attributes 或 .save [英] to_sql not working on update_attributes or .save
本文介绍了to_sql 不适用于 update_attributes 或 .save的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找一种方法来存储在更新或创建操作中生成的 sql 字符串.我尝试将 .to_sql
附加到 update_attributes
的末尾,但它返回一个 TrueClass
错误(或类似的错误).有什么我遗漏的吗?
I'm looking for a way to store the sql string that is generated in an update or create action. I've tried appending .to_sql
to the end of update_attributes
but it returns a TrueClass
error (or something like that). Is there something that I am missing?
推荐答案
这些方法都返回一个布尔值.您不能对布尔值调用 to_sql
.
These methods both return a boolean. You can't invoke to_sql
on a boolean.
这篇关于to_sql 不适用于 update_attributes 或 .save的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文