Closed campreb closed 7 years ago
@campreb - got it. I will take care of it next two days.
@campreb - it should be fixed in v2.2.7
. Check it, pls.
FYI: In your case I would recommend not to use custom validation but rather use present
and inclusion
validations. For ex:
validates :foobar, :kind, inclusion: { in: ['foo', 'bar'] }
validates :foobar, :relation_id, presence: { allow_blank: true }
or if you decide to use custom validation anyway then reference column names properly ( in curly brackets ):
validates :foobar, :relation_id, custom: { statement: "({relation_id} IS NOT NULL AND {kind} IN ('foo', 'bar'))", allow_nil: true }
We have encountered a strange problem when our custom statement includes single quotes, the quotes won't be properly serialized in the schema.rb.
For instance if we define in our migration:
Will output this in schema.rb once it is migrated: