Forum: Ruby on Rails Checking the existance of a NOT NULL constraint from Active

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
BigSmoke (Guest)
on 2005-12-15 21:52
(Received via mailing list)
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
Lou V. (Guest)
on 2005-12-16 00:49
(Received via mailing list)
do a,

   puts MyTable.columns.inspect

and you should see what you need.
[Hint: look for @null]
BigSmoke (Guest)
on 2005-12-17 17:12
(Received via mailing list)
It works. I now know where to look for this and related information.

Thanks a lot!

  - Rowan
This topic is locked and can not be replied to.