我有一个ActiveRecord before_save方法抛出了一个奇怪的错误:
class MyThing < ActiveRecord::Base
before_save :dostuff
def dostuff
p self.class.maximum(:mycolumn)
end
end当我使用SQLite时,这很好用,现在-使用postgresql-我得到了错误:
PGError: ERROR: current transaction is aborted, commands ignored until end of transaction block : SHOW max_identifier_length.maximum方法在dostuff方法之外工作,所以我想我可能要求太多了?是否有其他方法可以获得在before_save中工作的整型列的最大值
发布于 2010-04-19 19:56:36
错误消息是关于max_identifier_length的,即对象名(表、列等)的最大长度。它与SQL函数MAX()无关。看起来您使用的名称无效,名称长度超过63个字符。
https://stackoverflow.com/questions/2667051
复制相似问题