Câu hỏi phỏng vấn Ruby on Rails
Câu hỏi

List out what can Rails Migration do?

Câu trả lời

Rails migrations allow you to evolve your database schema over time using Ruby code instead of writing raw SQL. Here are some key things that Rails migrations can do:

  • Create new tables with specified columns and data types[1][2]. For example:
create_table :products do |t|
  t.string :name
  t.string :part_number
  t.timestamps
end
  • Add, remove, or change columns in existing tables[1]. For example:
add_column :products, :description, :text
remove_column :products, :part_number
  • Create associations between tables using references or belongs_to[1]. For example:
add_reference :products, :user, foreign_key: true
  • Create join tables for many-to-many associations[1]. For example:
create_join_table :customers, :products
  • Run arbitrary SQL statements[1]

  • Undo migrations if needed[1]

  • Provide a consi...

junior

junior

Gợi ý câu hỏi phỏng vấn

middle

Mention what is the purpose of RJs in Rails?

expert

Node.js vs Ruby on Rails. Which would you choose?

middle

Mention what is the difference between calling super() and super call ?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào