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

How Many Types Of Call...

Câu trả lời

There are four main types of callbacks available in Ruby on Rails:

  1. before_validation: Runs before validation so you can make sure your data is in good shape[1].

  2. before_save: This happens just before the record is saved, making it great for final adjustments[1].

  3. after_save: This runs right after the record is saved for things like sending notifications[1].

  4. after_commit: This occurs after the transaction is committed, ensuring data integrity[1].

Rails provides a total of nineteen callbacks in total, which give a lot of control over how to react and prepare for each state in the Active Record life cycle[3]. Some other callback types include:

  • before_create, after_create: Called before/after object creation
  • before_update, after_update: Calle...
senior

senior

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

expert

What is Dynamic Finders?

senior

What Is The Flash?

middle

What Is A Proc ?

Bình luận

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

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