Checking the existance of a NOT NULL constraint from Active


#1

Hi,

I’d like to check the existance of a NOT NULL constraint for a given
attribute using ActiveRecord. Is this possible or do I have to
painstakingly query the information_schema myself? I need this for
some reflection in a custom association.

Thanks,

  • Rowan

#2

do a,

puts MyTable.columns.inspect

and you should see what you need.
[Hint: look for @null]


#3

It works. I now know where to look for this and related information.

Thanks a lot!

  • Rowan