SlideShare a Scribd company logo
Rails Concerns and
Turbolinks
Presented by
Zahidul Hasan
What is Concerns?
• Concerns provides a way that allow us to keep our code organized
and DRY
• Basically, the idea is to extract common and/or context specific
chunks of code in order to clean up the models/controllers and avoid
them from getting too fat and messy
More Information
• Concerns are supported by Rails 3 but have become more official in
Rails 4
• Those who have worked with a Rails 4 app, might have probably
noticed the app/models/concerns and app/controllers/concerns
directories
Why should we use concerns?
• DRYing up model codes
• Skin-nizing Fat Models
DRYing up model codes
Create a commentable.rb file in
app/model/concerns
Skin-nizing Fat Models
• Create a attendable.rb file in app/model/concern/event folder
• Create a commentable.rb file in app/model/concern/event folder
Rails Concerns and Turbolinks
Controller Concerns
• Controllers can also have concerns
• Purpose will be the same: DRYing
Turbolinks
• Feature of rails 4
• Prevents the browser from reloading the JavaScript and CSS between
each page change
• Its almost similar to PJAX
JavaScript pushState
• Javascript API for HTML5: History Interface
• pushState can be used to store the navigation history
PJAX
• PJAX is a combination of the terms pushState and AJAX
• Instead of reloading the whole page when clicking a link, just load the
part of the page that needs updating
• On the client-side we have to define the container that should be
replaced when a link is clicked
Turbolinks
• Instead of replacing only parts a page it loads a complete website
from the server and replaces the <title> and <body> in the currently
loaded DOM
• Unlike PJAX we don't have to mark links and containers, Turbolinks
will handle that for us
Comparison between Turbolinks and PJAX
• Turbolinks definitely improve client-side page loading, but the server
still has to render the complete website
• PJAX renders only those parts of a website that really need to be
updated, need additional work when developing the application
• Turbolinks will improve page load significantly if the pages share
JavaScript and CSS styling. PJAX comes in handy, when server-side
performance is an issue
Thank You

More Related Content

What's hot (19)

PPTX
ACTIVE SERVER PAGES BY SAIKIRAN PANJALA
Saikiran Panjala
 
PPT
Automating SQL Server Database Creation for SharePoint
Talbott Crowell
 
PPTX
Standard List Controllers
Mohammed Safwat Abu Kwaik
 
PPTX
Deep Dive into the Content Query Web Part by Christina Wheeler - SPTechCon
SPTechCon
 
PDF
Microsoft Exchange Best Practices: Tips for Setup, Maintenance and Room Resou...
Teem
 
PPTX
Chris O'Brien - Introduction to the SharePoint Framework for developers
Chris O'Brien
 
PDF
SPSSTHLM - Using JSLink and Display Templates for ITPros
Paul Hunt
 
PPTX
Asp .net folders and web.config
baabtra.com - No. 1 supplier of quality freshers
 
PPT
Content deployment in MOSS 2007
Salaudeen Rajack
 
PPTX
Creating a Documentation Portal
Steve Anderson
 
PDF
Getting Started with Oracle APEX
DataNext Solutions
 
PPTX
ECS 19 Bert Jansen - Taking your SharePoint to the next level – Transforming ...
European Collaboration Summit
 
PPSX
Design mobile efficient Apis
Mobile Rtpl
 
PPTX
SharePoint 2013 variations feature
Melick Baranasooriya
 
PPT
single page application
Ravindra K
 
PPT
Amazon.com's Web Services Opportunity
Tim O'Reilly
 
PPTX
Mobile APIs in Practice
Tyler Singletary
 
PPT
My cool new Slideshow!
rommel_gagasa
 
ACTIVE SERVER PAGES BY SAIKIRAN PANJALA
Saikiran Panjala
 
Automating SQL Server Database Creation for SharePoint
Talbott Crowell
 
Standard List Controllers
Mohammed Safwat Abu Kwaik
 
Deep Dive into the Content Query Web Part by Christina Wheeler - SPTechCon
SPTechCon
 
Microsoft Exchange Best Practices: Tips for Setup, Maintenance and Room Resou...
Teem
 
Chris O'Brien - Introduction to the SharePoint Framework for developers
Chris O'Brien
 
SPSSTHLM - Using JSLink and Display Templates for ITPros
Paul Hunt
 
Asp .net folders and web.config
baabtra.com - No. 1 supplier of quality freshers
 
Content deployment in MOSS 2007
Salaudeen Rajack
 
Creating a Documentation Portal
Steve Anderson
 
Getting Started with Oracle APEX
DataNext Solutions
 
ECS 19 Bert Jansen - Taking your SharePoint to the next level – Transforming ...
European Collaboration Summit
 
Design mobile efficient Apis
Mobile Rtpl
 
SharePoint 2013 variations feature
Melick Baranasooriya
 
single page application
Ravindra K
 
Amazon.com's Web Services Opportunity
Tim O'Reilly
 
Mobile APIs in Practice
Tyler Singletary
 
My cool new Slideshow!
rommel_gagasa
 

Viewers also liked (10)

PDF
Interfaces ricas com Rails e React.JS @ Rubyconf 2015
Rodrigo Urubatan
 
PDF
Efficient rails
fabio perrella
 
PPTX
Real-Time Rails: Implementing WebSockets in Rails 5 with Action Cable
Sophie DeBenedetto
 
PPTX
ウェブチップス勉強会 Action cable
Yu Ito
 
PDF
Real Time with Rails 5
Lucas Renan
 
PDF
What's new in Rails 5 - API Mode & Action Cable overview
Maxim Veksler
 
PDF
Ruby on Rails 5: Top 5 Features
PhraseApp
 
PDF
Rails 5 – Amsterdam.rb – Uberous
Jeroen Visser
 
PPT
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?
Srijan Technologies
 
PDF
What's New in Rails 5
Marko Sanković
 
Interfaces ricas com Rails e React.JS @ Rubyconf 2015
Rodrigo Urubatan
 
Efficient rails
fabio perrella
 
Real-Time Rails: Implementing WebSockets in Rails 5 with Action Cable
Sophie DeBenedetto
 
ウェブチップス勉強会 Action cable
Yu Ito
 
Real Time with Rails 5
Lucas Renan
 
What's new in Rails 5 - API Mode & Action Cable overview
Maxim Veksler
 
Ruby on Rails 5: Top 5 Features
PhraseApp
 
Rails 5 – Amsterdam.rb – Uberous
Jeroen Visser
 
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?
Srijan Technologies
 
What's New in Rails 5
Marko Sanković
 
Ad

Similar to Rails Concerns and Turbolinks (20)

PPTX
Website Performance
Hugo Fonseca
 
PPTX
React js
Nikhil Karkra
 
PPTX
Integrate Applications into IBM Connections Cloud and On Premises (AD 1632)
TIMETOACT GROUP
 
PPTX
Full Stack_Reac web Development and Application
Jeyarajs7
 
PPTX
EVOLVE'16 | Enhance | Paul McMahon | Approaches to Leveraging AEM Within a Si...
Evolve The Adobe Digital Marketing Community
 
PDF
React on rails v4
Justin Gordon
 
PPTX
Reactjs notes.pptx for web development- tutorial and theory
jobinThomas54
 
PDF
Keep Your Code Organized! WordCamp Montreal 2013 Presentation slides
Jer Clarke
 
PPTX
Designyourownblog.com On-Site SEO Auidt
James Allen
 
PDF
Rails request & middlewares
Santosh Wadghule
 
PPTX
Rails Request & Middlewares
Santosh Wadghule
 
PPTX
How to make React Applications SEO-friendly
Fibonalabs
 
ODP
Introduction to rails 4 v1
Muhammad Irfan
 
PDF
Build single page applications using AngularJS on AEM
connectwebex
 
PPTX
Build single page applications using AngularJS on AEM
AdobeMarketingCloud
 
PPTX
Build single page applications using AngularJS on AEM
AdobeMarketingCloud
 
PPTX
Sps redmond 2014 deck
Dorinda Reyes
 
PDF
Asp.Net 3 5 Part 1
asim78
 
PPTX
intro to react| React: dynamic UIs, component-based, virtual DOM, JSX, effici...
IbadUddin4
 
Website Performance
Hugo Fonseca
 
React js
Nikhil Karkra
 
Integrate Applications into IBM Connections Cloud and On Premises (AD 1632)
TIMETOACT GROUP
 
Full Stack_Reac web Development and Application
Jeyarajs7
 
EVOLVE'16 | Enhance | Paul McMahon | Approaches to Leveraging AEM Within a Si...
Evolve The Adobe Digital Marketing Community
 
React on rails v4
Justin Gordon
 
Reactjs notes.pptx for web development- tutorial and theory
jobinThomas54
 
Keep Your Code Organized! WordCamp Montreal 2013 Presentation slides
Jer Clarke
 
Designyourownblog.com On-Site SEO Auidt
James Allen
 
Rails request & middlewares
Santosh Wadghule
 
Rails Request & Middlewares
Santosh Wadghule
 
How to make React Applications SEO-friendly
Fibonalabs
 
Introduction to rails 4 v1
Muhammad Irfan
 
Build single page applications using AngularJS on AEM
connectwebex
 
Build single page applications using AngularJS on AEM
AdobeMarketingCloud
 
Build single page applications using AngularJS on AEM
AdobeMarketingCloud
 
Sps redmond 2014 deck
Dorinda Reyes
 
Asp.Net 3 5 Part 1
asim78
 
intro to react| React: dynamic UIs, component-based, virtual DOM, JSX, effici...
IbadUddin4
 
Ad

More from Nascenia IT (20)

PPTX
Exploring DeepSeek A Hands-On Dive & How to Adapt the AI Surge.pptx
Nascenia IT
 
PPTX
AI Tools for Productivity: Exploring Prompt Engineering and Key Features
Nascenia IT
 
PDF
Introduction to basic data analytics tools
Nascenia IT
 
PPTX
Communication workshop in nascenia
Nascenia IT
 
PPTX
The Art of Statistical Deception
Nascenia IT
 
PDF
করোনায় কী করি!
Nascenia IT
 
PPTX
GDPR compliance expectations from the development team
Nascenia IT
 
PPTX
Writing Clean Code
Nascenia IT
 
PPTX
History & Introduction of Neural Network and use of it in Computer Vision
Nascenia IT
 
PPTX
Ruby on Rails: Coding Guideline
Nascenia IT
 
PPTX
iphone 11 new features
Nascenia IT
 
PPTX
Software quality assurance and cyber security
Nascenia IT
 
PPTX
Job Market Scenario For Freshers
Nascenia IT
 
PPTX
Modern Frontend Technologies (BEM, Retina)
Nascenia IT
 
PPTX
CSS for Developers
Nascenia IT
 
PPTX
Big commerce app development
Nascenia IT
 
PPTX
Integrating QuickBooks Desktop with Rails Application
Nascenia IT
 
PPTX
Shopify
Nascenia IT
 
PPTX
TypeScript: Basic Features and Compilation Guide
Nascenia IT
 
PPTX
Clean code
Nascenia IT
 
Exploring DeepSeek A Hands-On Dive & How to Adapt the AI Surge.pptx
Nascenia IT
 
AI Tools for Productivity: Exploring Prompt Engineering and Key Features
Nascenia IT
 
Introduction to basic data analytics tools
Nascenia IT
 
Communication workshop in nascenia
Nascenia IT
 
The Art of Statistical Deception
Nascenia IT
 
করোনায় কী করি!
Nascenia IT
 
GDPR compliance expectations from the development team
Nascenia IT
 
Writing Clean Code
Nascenia IT
 
History & Introduction of Neural Network and use of it in Computer Vision
Nascenia IT
 
Ruby on Rails: Coding Guideline
Nascenia IT
 
iphone 11 new features
Nascenia IT
 
Software quality assurance and cyber security
Nascenia IT
 
Job Market Scenario For Freshers
Nascenia IT
 
Modern Frontend Technologies (BEM, Retina)
Nascenia IT
 
CSS for Developers
Nascenia IT
 
Big commerce app development
Nascenia IT
 
Integrating QuickBooks Desktop with Rails Application
Nascenia IT
 
Shopify
Nascenia IT
 
TypeScript: Basic Features and Compilation Guide
Nascenia IT
 
Clean code
Nascenia IT
 

Recently uploaded (20)

PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PPT
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 

Rails Concerns and Turbolinks

  • 2. What is Concerns? • Concerns provides a way that allow us to keep our code organized and DRY • Basically, the idea is to extract common and/or context specific chunks of code in order to clean up the models/controllers and avoid them from getting too fat and messy
  • 3. More Information • Concerns are supported by Rails 3 but have become more official in Rails 4 • Those who have worked with a Rails 4 app, might have probably noticed the app/models/concerns and app/controllers/concerns directories
  • 4. Why should we use concerns? • DRYing up model codes • Skin-nizing Fat Models
  • 6. Create a commentable.rb file in app/model/concerns
  • 8. • Create a attendable.rb file in app/model/concern/event folder
  • 9. • Create a commentable.rb file in app/model/concern/event folder
  • 11. Controller Concerns • Controllers can also have concerns • Purpose will be the same: DRYing
  • 12. Turbolinks • Feature of rails 4 • Prevents the browser from reloading the JavaScript and CSS between each page change • Its almost similar to PJAX
  • 13. JavaScript pushState • Javascript API for HTML5: History Interface • pushState can be used to store the navigation history
  • 14. PJAX • PJAX is a combination of the terms pushState and AJAX • Instead of reloading the whole page when clicking a link, just load the part of the page that needs updating • On the client-side we have to define the container that should be replaced when a link is clicked
  • 15. Turbolinks • Instead of replacing only parts a page it loads a complete website from the server and replaces the <title> and <body> in the currently loaded DOM • Unlike PJAX we don't have to mark links and containers, Turbolinks will handle that for us
  • 16. Comparison between Turbolinks and PJAX • Turbolinks definitely improve client-side page loading, but the server still has to render the complete website • PJAX renders only those parts of a website that really need to be updated, need additional work when developing the application • Turbolinks will improve page load significantly if the pages share JavaScript and CSS styling. PJAX comes in handy, when server-side performance is an issue