October 10

0 comments

Rails- How to tell the type of a column.

By Christopher Mendla

October 10, 2016


Last Updated on November 30, 2019 by Christopher G Mendla

I was working with a Rails app that pulled data from a non rails database.

Things were a bit quirky and I wanted to double check the type of the column. I found that putting the following in a view will work.

<%= opportunity.column_for_attribute(‘yearly_sales’).type %> 


In this case, it returned “decimal”. 


Christopher Mendla

About the author

Leave a Reply

Your email address will not be published. Required fields are marked

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}