Add list of data types to Active Record Basics / Migrations Guide

Hi. Didn’t see anything about this so … I think it would be helpful to add the data types that are available in Active Record Basics or Active Record Migrations. There used to be a sentence back in v3.0 of the Guides:

The types supported by Active Record are :primary_key, :string, :text, :integer, :float, :decimal, :datetime, :timestamp, :time, :date, :binary, :boolean.

It would be very helpful for new folks or folks that haven’t coded in quite a while (like me) and need a little help.

Cheers Shannon

3 Likes

Would this technically differ based on which database ones uses?

It should be database independent as Active Record handles the specifics of talking to the database.

We have ActiveRecord::ConnectionAdapters::SchemaStatements

That defines the common types and then for PostgreSQL we have these: https://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/PostgreSQL/ColumnMethods.html

I skimmed through the rails guides, but there’s no reference… maybe open a new doc issue?

1 Like