I have an ActiveRecord before_save
method throwing an odd error:
class MyThing < ActiveRecord::Base
before_save :dostuff
def dostuff
p self.class.maximum(:mycolumn)
end
end
When I was using SQLite this worked perfectly, now—with postgresql—I get the error:
PGError: ERROR: current transaction is aborted, commands ignored until end of transaction block : SHOW max_identifier_length
The .maximum
method works outside that dostuff
method, so I guess I'm just asking too much at once? Is there another way to get the maximum value of an integer column that will work inside a before_save
?