SlideShare ist ein Scribd-Unternehmen logo
1 von 20
Rails Engine
An awesome tool to extend your rails application




               Muntasim Ahmed
   Platform Architect @ Tasawr Interactive
         https://github.com/railscash
            muntasim@tasawr.com
Agenda

•   Why Rails Engine
•   What is Rails Engine
•   How it works with Rails Core
•   Who are they
•   Where is your interest
Problems
• Large application without reusable component
• Slow testing ( if any :) )
• Larger app, messy
Solution
• Find common functionalities
• Extract them to module => Gems
• Use railtie to tie with Rails App => Rails Engine
One Thing!

Rails (version>=3.1) is just a “supercharged” engine

               http://edgeguides.rubyonrails.org/engines.html
Rails Engine ?

• pre-packaged application
• able to be run or mounted within another Rails
  application
• can have its own models, views, controllers,
  generators and publicly served static files
Rails Engine ?

•
Rails Engine has




      Image source: Railscasts.com
Rails Engine has




     Image source: Google
Rails Engine has




        Image source: Google
Rails Engine has




         Image source: Google
Rails engine walk-through
•   Create an engine
•   Implement requirements in app, lib etc.
•   Test
•   Mount to main app
•   Override where necessary
•   And done!
Rails engine walk-through

Create
rails plugin new awesome_engine --mountable

Then generate mvc stuffs, test


In App Gemfile
gem "awesome_engine", path => "awesome_engine_path


In App Route
mount AwesomeEngine::Engine => "/awesome_engine_path", as =>
“awesome_engine"
Rails engine walk-through

Hit localhost:3000/awesome_engine_path
                                    (mount point)

It will hit engine's root path



     Welcome to awesome engine
               home!
Rails engine walk-through

Routes:

Use engine routes from main app using
engine_name.route_name

e.g.   awesome_name.root_path
Rails engine walk-through

Routes:

Use main app routes from engine using
main_app.route_name

e.g. main_app.root_path
Who are they

•   Rails Admin
•   Devise
•   Blogit
•   Tolk
•   .....
References

•   http://railscasts.com/episodes/277-mountable-engines
•   http://www.slideshare.net/AndyMaleh/rails-engine-patterns
•   http://www.slideshare.net/mirrec/rails-engine-rubyslava
•   http://edgeguides.rubyonrails.org/engines.html
•   http://edgeapi.rubyonrails.org/classes/Rails/Engine.html
•   http://pivotallabs.com/users/shagemann/blog/articles/1994-
    migrating-rom-a-single-rails-app-to-a-suite-of-rails-engines



                                                    Image source:
                                Google, Railscasts and Dulal Khan
Thanks for your attention :)
???

Question(s)

Weitere ähnliche Inhalte

Was ist angesagt?

Laravel Restful API and AngularJS
Laravel Restful API and AngularJSLaravel Restful API and AngularJS
Laravel Restful API and AngularJS
Blake Newman
 
Slim3 quick start
Slim3 quick startSlim3 quick start
Slim3 quick start
Guangyao Cao
 

Was ist angesagt? (20)

React.js for Rails Developers
React.js for Rails DevelopersReact.js for Rails Developers
React.js for Rails Developers
 
Rails Engines as a way to Micro services
Rails Engines as a way to Micro servicesRails Engines as a way to Micro services
Rails Engines as a way to Micro services
 
React on rails v6.1 at LA Ruby, November 2016
React on rails v6.1 at LA Ruby, November 2016React on rails v6.1 at LA Ruby, November 2016
React on rails v6.1 at LA Ruby, November 2016
 
How angularjs saves rails
How angularjs saves railsHow angularjs saves rails
How angularjs saves rails
 
Project Fedena and Why Ruby on Rails - ArvindArvind G S
Project Fedena and Why Ruby on Rails - ArvindArvind G SProject Fedena and Why Ruby on Rails - ArvindArvind G S
Project Fedena and Why Ruby on Rails - ArvindArvind G S
 
AngularJS meets Rails
AngularJS meets RailsAngularJS meets Rails
AngularJS meets Rails
 
How to set up and test a Rails 3 Engine
How to set up and test a Rails 3 EngineHow to set up and test a Rails 3 Engine
How to set up and test a Rails 3 Engine
 
API Development with Laravel
API Development with LaravelAPI Development with Laravel
API Development with Laravel
 
AEM - A Collection of developer friendly tools
AEM - A Collection of developer friendly toolsAEM - A Collection of developer friendly tools
AEM - A Collection of developer friendly tools
 
Brief Introduction to Ember
Brief Introduction to EmberBrief Introduction to Ember
Brief Introduction to Ember
 
Backbonification for dummies - Arrrrug 10/1/2012
Backbonification for dummies - Arrrrug 10/1/2012Backbonification for dummies - Arrrrug 10/1/2012
Backbonification for dummies - Arrrrug 10/1/2012
 
Laravel Restful API and AngularJS
Laravel Restful API and AngularJSLaravel Restful API and AngularJS
Laravel Restful API and AngularJS
 
An Intense Overview of the React Ecosystem
An Intense Overview of the React EcosystemAn Intense Overview of the React Ecosystem
An Intense Overview of the React Ecosystem
 
Be Happy With Ruby on Rails - Ecosystem
Be Happy With Ruby on Rails - EcosystemBe Happy With Ruby on Rails - Ecosystem
Be Happy With Ruby on Rails - Ecosystem
 
Web Development with Laravel 5
Web Development with Laravel 5Web Development with Laravel 5
Web Development with Laravel 5
 
Story ofcorespring infodeck
Story ofcorespring infodeckStory ofcorespring infodeck
Story ofcorespring infodeck
 
RoR 101: Session 5
RoR 101: Session 5RoR 101: Session 5
RoR 101: Session 5
 
Slim3 quick start
Slim3 quick startSlim3 quick start
Slim3 quick start
 
RoR 101: Session 3
RoR 101: Session 3RoR 101: Session 3
RoR 101: Session 3
 
EmberJS BucharestJS
EmberJS BucharestJSEmberJS BucharestJS
EmberJS BucharestJS
 

Ähnlich wie Rails Engine :: modularize you app

Ember App Kit & The Ember Resolver
Ember App Kit & The Ember ResolverEmber App Kit & The Ember Resolver
Ember App Kit & The Ember Resolver
tboyt
 
Rails engines
Rails enginesRails engines
Rails engines
Josh Schramm
 
Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012
Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012
Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012
Andy Maleh
 

Ähnlich wie Rails Engine :: modularize you app (20)

Rails engines
Rails enginesRails engines
Rails engines
 
Rails engine
Rails engineRails engine
Rails engine
 
Ember App Kit & The Ember Resolver
Ember App Kit & The Ember ResolverEmber App Kit & The Ember Resolver
Ember App Kit & The Ember Resolver
 
Rails engines
Rails enginesRails engines
Rails engines
 
Rails Engines
Rails EnginesRails Engines
Rails Engines
 
Moving complex enterprise ecommerce systems to the cloud
Moving complex enterprise ecommerce systems to the cloudMoving complex enterprise ecommerce systems to the cloud
Moving complex enterprise ecommerce systems to the cloud
 
Client Side MVC with Backbone and Rails
Client Side MVC with Backbone and RailsClient Side MVC with Backbone and Rails
Client Side MVC with Backbone and Rails
 
Rails request & middlewares
Rails request & middlewaresRails request & middlewares
Rails request & middlewares
 
Rails engines
Rails enginesRails engines
Rails engines
 
Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012
Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012
Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012
 
Rails Engines
Rails EnginesRails Engines
Rails Engines
 
Rails Engines - A presentation for the 22nd Athens Ruby Meetup
Rails Engines - A presentation for the 22nd Athens Ruby MeetupRails Engines - A presentation for the 22nd Athens Ruby Meetup
Rails Engines - A presentation for the 22nd Athens Ruby Meetup
 
Latest & interesting updates #android dev
Latest & interesting updates #android devLatest & interesting updates #android dev
Latest & interesting updates #android dev
 
Riding the Edge with Ember.js
Riding the Edge with Ember.jsRiding the Edge with Ember.js
Riding the Edge with Ember.js
 
Ruby on Rails Penetration Testing
Ruby on Rails Penetration TestingRuby on Rails Penetration Testing
Ruby on Rails Penetration Testing
 
Learning Rails
Learning RailsLearning Rails
Learning Rails
 
Introduction to Ember.js and how we used it at FlowPro.io
Introduction to Ember.js and how we used it at FlowPro.ioIntroduction to Ember.js and how we used it at FlowPro.io
Introduction to Ember.js and how we used it at FlowPro.io
 
Lightening a component based Rails architecture
Lightening a component based Rails architectureLightening a component based Rails architecture
Lightening a component based Rails architecture
 
Selenium topic 3 -Web Driver Basics
Selenium topic 3 -Web Driver BasicsSelenium topic 3 -Web Driver Basics
Selenium topic 3 -Web Driver Basics
 
End to-End SPA Development Using ASP.NET and AngularJS
End to-End SPA Development Using ASP.NET and AngularJSEnd to-End SPA Development Using ASP.NET and AngularJS
End to-End SPA Development Using ASP.NET and AngularJS
 

KĂźrzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

KĂźrzlich hochgeladen (20)

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Rails Engine :: modularize you app

  • 1. Rails Engine An awesome tool to extend your rails application Muntasim Ahmed Platform Architect @ Tasawr Interactive https://github.com/railscash muntasim@tasawr.com
  • 2. Agenda • Why Rails Engine • What is Rails Engine • How it works with Rails Core • Who are they • Where is your interest
  • 3. Problems • Large application without reusable component • Slow testing ( if any :) ) • Larger app, messy
  • 4. Solution • Find common functionalities • Extract them to module => Gems • Use railtie to tie with Rails App => Rails Engine
  • 5. One Thing! Rails (version>=3.1) is just a “supercharged” engine http://edgeguides.rubyonrails.org/engines.html
  • 6. Rails Engine ? • pre-packaged application • able to be run or mounted within another Rails application • can have its own models, views, controllers, generators and publicly served static files
  • 8. Rails Engine has Image source: Railscasts.com
  • 9. Rails Engine has Image source: Google
  • 10. Rails Engine has Image source: Google
  • 11. Rails Engine has Image source: Google
  • 12. Rails engine walk-through • Create an engine • Implement requirements in app, lib etc. • Test • Mount to main app • Override where necessary • And done!
  • 13. Rails engine walk-through Create rails plugin new awesome_engine --mountable Then generate mvc stuffs, test In App Gemfile gem "awesome_engine", path => "awesome_engine_path In App Route mount AwesomeEngine::Engine => "/awesome_engine_path", as => “awesome_engine"
  • 14. Rails engine walk-through Hit localhost:3000/awesome_engine_path (mount point) It will hit engine's root path Welcome to awesome engine home!
  • 15. Rails engine walk-through Routes: Use engine routes from main app using engine_name.route_name e.g. awesome_name.root_path
  • 16. Rails engine walk-through Routes: Use main app routes from engine using main_app.route_name e.g. main_app.root_path
  • 17. Who are they • Rails Admin • Devise • Blogit • Tolk • .....
  • 18. References • http://railscasts.com/episodes/277-mountable-engines • http://www.slideshare.net/AndyMaleh/rails-engine-patterns • http://www.slideshare.net/mirrec/rails-engine-rubyslava • http://edgeguides.rubyonrails.org/engines.html • http://edgeapi.rubyonrails.org/classes/Rails/Engine.html • http://pivotallabs.com/users/shagemann/blog/articles/1994- migrating-rom-a-single-rails-app-to-a-suite-of-rails-engines Image source: Google, Railscasts and Dulal Khan
  • 19. Thanks for your attention :)