Toshimaru's Blog

Show Active Record Model column names

Active Record provides a column_names method to show column names of a Model.

User.column_names
# => ["id", "name", "email", "password_digest", "created_at", "updated_at"]

See also