Home Programming Rails: How to get Column Types in ActiveRecord

Rails: How to get Column Types in ActiveRecord

0
154

You can use the columns method to get the types of columns in an ActiveRecord. With that, you can perform functions on the data and know ahead of time what kind of data you are working with.

https://gist.github.com/thehashrocket/cbcdfcefa9aaf66ed177bfedf4f0d44e.js