# Rails Engines และแอปแบบโมดูลาร์ (Ruby on Rails) > Mountable engines, isolated engines, namespacing, สถาปัตยกรรมแบบ gem - 18 คำถามสัมภาษณ์ - Senior - [คำถามสัมภาษณ์: Ruby on Rails](https://sharpskill.dev/th/technologies/ruby-on-rails/interview-questions.md) ## 1. Rails Engine คืออะไร? **คำตอบ** Rails Engine คือแอปพลิเคชัน Rails ขนาดย่อที่สามารถ mount เข้าไปในแอปพลิเคชัน host ได้ มันช่วยให้แชร์โค้ด (models, controllers, views, routes) ระหว่างหลายแอปพลิเคชัน หรือสร้างฟีเจอร์ที่แยกอิสระและนำกลับมาใช้ใหม่ได้ gem อย่าง Devise, Sidekiq Web UI และ ActiveAdmin เป็นตัวอย่างของ engine ยอดนิยมที่ใช้ในระบบนิเวศ Rails ## 2. คำสั่งใดที่ใช้สร้าง Rails Engine แบบ mountable ใหม่? **คำตอบ** คำสั่ง rails plugin new พร้อมตัวเลือก --mountable จะสร้าง engine ที่สมบูรณ์พร้อม namespace ของตัวเอง routes ที่แยกอิสระ และโครงสร้างโฟลเดอร์ ตัวเลือก --mountable สร้าง engine ที่แยกอิสระอย่างสมบูรณ์จากแอปพลิเคชัน host ต่างจาก --full ที่สร้าง engine แบบไม่แยกอิสระซึ่งใช้ namespace ของแอปพลิเคชันหลักร่วมกัน ## 3. ความแตกต่างหลักระหว่าง engine --mountable กับ engine --full คืออะไร? **คำตอบ** engine --mountable แยกอิสระอย่างสมบูรณ์ด้วย namespace (module) ของตัวเอง helpers ของตัวเอง และ routes ที่แยกอิสระภายใต้คำนำหน้าที่กำหนดค่าได้ ส่วน engine --full ใช้ namespace ของแอปพลิเคชัน host ร่วมกัน ซึ่งอาจทำให้เกิดความขัดแย้งของชื่อ การแยกอิสระของ mountable engine ช่วยให้แน่ใจว่าคลาสและ routes ของ engine ไม่ไปรบกวน namespace ของแอปพลิเคชันหลัก ## มีอีก 15 คำถาม - จะ mount Rails Engine ในไฟล์ routes.rb ของแอปพลิเคชัน host อย่างไร? - ไดเรกทีฟ isolate_namespace ใน Rails Engine มีจุดประสงค์อะไร? สมัครฟรี: https://sharpskill.dev/th/login ## หัวข้อสัมภาษณ์ Ruby on Rails อื่นๆ - [พื้นฐาน Ruby](https://sharpskill.dev/th/technologies/ruby-on-rails/interview-questions/ruby-basics.md): 25 คำถาม, Junior - [การเขียนโปรแกรมเชิงวัตถุใน Ruby](https://sharpskill.dev/th/technologies/ruby-on-rails/interview-questions/ruby-oop.md): 20 คำถาม, Junior - [พื้นฐาน Rails](https://sharpskill.dev/th/technologies/ruby-on-rails/interview-questions/rails-fundamentals.md): 18 คำถาม, Junior - [Routing & Controllers](https://sharpskill.dev/th/technologies/ruby-on-rails/interview-questions/routing-controllers.md): 22 คำถาม, Junior - [พื้นฐาน ActiveRecord](https://sharpskill.dev/th/technologies/ruby-on-rails/interview-questions/active-record-basics.md): 25 คำถาม, Junior - [Views และ ERB Templates](https://sharpskill.dev/th/technologies/ruby-on-rails/interview-questions/views-erb-templates.md): 20 คำถาม, Junior - [การเชื่อมโยงของ ActiveRecord](https://sharpskill.dev/th/technologies/ruby-on-rails/interview-questions/active-record-associations.md): 24 คำถาม, Mid-Level - [การสอบถาม ActiveRecord ขั้นสูง](https://sharpskill.dev/th/technologies/ruby-on-rails/interview-questions/active-record-queries.md): 28 คำถาม, Mid-Level - [ฟอร์ม Rails](https://sharpskill.dev/th/technologies/ruby-on-rails/interview-questions/rails-forms.md): 20 คำถาม, Mid-Level - [การยืนยันตัวตนและการอนุญาต](https://sharpskill.dev/th/technologies/ruby-on-rails/interview-questions/authentication-authorization.md): 22 คำถาม, Mid-Level - [Asset Pipeline สมัยใหม่และ frontend](https://sharpskill.dev/th/technologies/ruby-on-rails/interview-questions/rails-asset-pipeline.md): 18 คำถาม, Mid-Level - [โหมด API ของ Rails](https://sharpskill.dev/th/technologies/ruby-on-rails/interview-questions/rails-api-mode.md): 20 คำถาม, Mid-Level - [การทดสอบด้วย RSpec](https://sharpskill.dev/th/technologies/ruby-on-rails/interview-questions/rails-testing-rspec.md): 24 คำถาม, Mid-Level - [ActiveJob & Background Jobs](https://sharpskill.dev/th/technologies/ruby-on-rails/interview-questions/active-job-background-jobs.md): 20 คำถาม, Mid-Level - [ActionCable & WebSockets](https://sharpskill.dev/th/technologies/ruby-on-rails/interview-questions/action-cable-websockets.md): 18 คำถาม, Mid-Level - [ActionMailer](https://sharpskill.dev/th/technologies/ruby-on-rails/interview-questions/action-mailer.md): 18 คำถาม, Mid-Level - [ActiveStorage](https://sharpskill.dev/th/technologies/ruby-on-rails/interview-questions/active-storage.md): 20 คำถาม, Mid-Level - [กลยุทธ์การ Caching](https://sharpskill.dev/th/technologies/ruby-on-rails/interview-questions/caching-strategies.md): 20 คำถาม, Mid-Level - [การ Migration ขั้นสูง](https://sharpskill.dev/th/technologies/ruby-on-rails/interview-questions/database-migrations-advanced.md): 20 คำถาม, Mid-Level - [การเพิ่มประสิทธิภาพการทำงาน](https://sharpskill.dev/th/technologies/ruby-on-rails/interview-questions/performance-optimization.md): 26 คำถาม, Senior - [Design Patterns ใน Rails](https://sharpskill.dev/th/technologies/ruby-on-rails/interview-questions/rails-design-patterns.md): 22 คำถาม, Senior - [เมตาโปรแกรมมิงใน Ruby](https://sharpskill.dev/th/technologies/ruby-on-rails/interview-questions/ruby-metaprogramming.md): 20 คำถาม, Senior - [ความปลอดภัยของ Rails](https://sharpskill.dev/th/technologies/ruby-on-rails/interview-questions/rails-security.md): 22 คำถาม, Senior - [GraphQL กับ Rails](https://sharpskill.dev/th/technologies/ruby-on-rails/interview-questions/graphql-rails.md): 20 คำถาม, Senior - [การดีพลอยและโปรดักชัน](https://sharpskill.dev/th/technologies/ruby-on-rails/interview-questions/rails-deployment-production.md): 20 คำถาม, Senior - [Monitoring & Logging](https://sharpskill.dev/th/technologies/ruby-on-rails/interview-questions/monitoring-logging.md): 20 คำถาม, Senior - [กลยุทธ์การอัปเกรด Rails](https://sharpskill.dev/th/technologies/ruby-on-rails/interview-questions/rails-upgrade-strategies.md): 18 คำถาม, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/th/technologies/ruby-on-rails/interview-questions/rails-engines-modular-apps