'Ruby syntax in ActiveRecord
I am currently doing the ruby on rails beginner tutorials and I do not understand the specific syntax of migrations.
class CreateArticles < ActiveRecord::Migration[7.0]
def change
create_table :articles do |t|
t.string :title
t.text :body
t.timestamps
end
end
end
Specifically, I do not understand the syntax within the method change on line 3.
What does create_table refers to?
What does :articles means? Is it a symbol?
What is the |t| in this case referring to. To a new table?
Any context and deeper explanations of this code would be appreciated.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
