BigSmoke
2005-Dec-15 19:52 UTC
Checking the existance of a NOT NULL constraint from Active Record
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 -- Morality is usually taught by the immoral. _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Lou Vanek
2005-Dec-15 22:42 UTC
Re: Checking the existance of a NOT NULL constraint from Active Record
do a, puts MyTable.columns.inspect and you should see what you need. [Hint: look for @null] BigSmoke wrote:> 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
BigSmoke
2005-Dec-17 15:11 UTC
Re: Re: Checking the existance of a NOT NULL constraint from Active Record
It works. I now know where to look for this and related information. Thanks a lot! - Rowan On 12/15/05, Lou Vanek <vanek@acd.net> wrote:> do a, > > puts MyTable.columns.inspect > > and you should see what you need. > [Hint: look for @null] > > > > BigSmoke wrote: > > > 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-- Morality is usually taught by the immoral. _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails