Rails: How to get Column Types in ActiveRecord

Jason Shultz
Jan 5, 2017 · 1 min read

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.

Chaos Elevators

Tips, Stories, and Thoughts by Me, Hashrocket

Jason Shultz

Written by

Software Engineer at 3form in SLC. Mountain Biker and Backpacker. Father of two.

Chaos Elevators

Tips, Stories, and Thoughts by Me, Hashrocket

More From Medium

Related reads

Related reads

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade