rails c
Open the console with.
User.column_names
Check the column with. Then, as shown below, it is possible to acquire and confirm only the column name currently being created without acquiring other unnecessary information.
[1] pry(main)> User.column_names
=> ["id",
"email",
"encrypted_password",
"reset_password_token",
"reset_password_sent_at",
"remember_created_at",
"created_at",
"updated_at"]
By the way, the same confirmation can be done with User.columns.map (&: name).
[2] pry(main)> User.columns.map(&:name)
=> ["id",
"email",
"encrypted_password",
"reset_password_token",
"reset_password_sent_at",
"remember_created_at",
"created_at",
"updated_at"]
However, since the description is long in this case, it seems better to check with User column_names ◯
Recommended Posts