Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Rails engines

2,025 views

Published on

Published in: Education, Technology
  • Be the first to comment

  • Be the first to like this

Rails engines

  1. 1. Rails Engines - what, why, how Grzegorz Witek
  2. 2. Agenda • What engines are • How they appeared in Rails core • How to use them • What are their pros and cons • Summary
  3. 3. What engines are Application Engine Plugins
  4. 4. What are their capabilities? Rails engines have: Rack middleware stack
  5. 5. What are their capabilities? Rails engines have: environment.rb
  6. 6. What are their capabilities? Rails engines have: Routes
  7. 7. What are their capabilities? Rails engines have: Plugin support
  8. 8. Long way to the CORE • Plugin • Rails 2.3 - partial support • 2010 Ruby Summer of Code • Rails 3.1 - full engines in core • ... • 2011? - a few apps in the same process
  9. 9. A bit of code Rails.application.routes.draw do mount Cms::Engine => "/portal", :as => 'cms' end main_application.root_pathcms.articles_path rake railties:copy_migrations authenticate :admin do mount Tolk::Engine => "/tolk" end
  10. 10. Are they really worth using? Pros: • they are almost as powerful as rails app • they are isolated (you don't need to change your code to use them!) • You can share code between applications • they can save your time! Cons: • they're not suitable for every application
  11. 11. Do they exist? • Devise • Rails Admin • Rails Assets (to be released in 3.1) • Tolk
  12. 12. Any questions? Thanks for your attention!
  13. 13. Sources: • http://piotrsarnacki.com • https://github.com/dhh/tolk • http://rails-engines.org/  • http://railscasts.com/episodes/149-rails-engines • http://github.com/sferik/rails_admin • https://github.com/lazyatom/engines • https://github.com/rails/rails

×