How can I get the datatype of an attribute from a Rails model?

I am using Postgres in a Rails project and I have discovered that I need to change all of my varchar datatypes to citext. Rather than do this by hand, I want to just create a migration that loops through all of the models and their attributes and converts them as necessary.

Most of these models are empty, so it's not a matter of instantiating them. I need to find out if ActiveRecord "knows" what the datatype of its corresponding database column is.



That might be what you're looking for.

Need Your Help

Under what circumstances can a Magento Order Increment ID have duplicates?

magento magento-1.4

I've been running into some odd problems of late with a Magento installation (, whereby the same order increment ID is being reused for more than one order.

Negative match RewriteCond not working

apache .htaccess mod-rewrite rewrite match

I'm experimenting with an idea and trying to keep Yahoo Slurp-bot on my website but redirect everyone else via a 301 redirect. I cannot get a negative match. Sending Slurp to and keeping

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.