SlideShare a Scribd company logo
1 of 7
Draper
Decorators/View-Models for Rails Applications
Visnupriya. J .R
7th April 2014
@visnupriya90| github.com/visnupriya
© Spritle Software Private Limited | http://www.spritle.com
What is Draper?
• object-oriented layer of presentation
logic to your Rails application.
• The idea of Draper is to provide real ruby
class between the template and the
model.
• To decorate templates.
© Spritle Software Private Limited | http://www.spritle.com
Why use Draper?
• Clean up complex view logic
• Provides decorators which
bundles view logic in an object
oriented fashion
• Easy to test than helpers
• Code readability and easy to
maintain
• Code reuse
© Spritle Software Private Limited | http://www.spritle.com
What is Decorator Pattern?
• It is a design pattern.
• It allows behavior to be added to an
individual object, either statically or
dynamically, without affecting the behavior of
other objects from the same class
© Spritle Software Private Limited | http://www.spritle.com
Let’s see how to use?
• Add Draper to your Gemfile
• Generate decorator for a model as shown
below
• rails generate decorator Article
© Spritle Software Private Limited | http://www.spritle.com
SAMPLE CODE
Time to wakeup
© Spritle Software Private Limited | http://www.spritle.com
Questions?
Thank you
© Spritle Software Private Limited | http://www.spritle.com

More Related Content

What's hot

Webpack and angularjs
Webpack and angularjsWebpack and angularjs
Webpack and angularjsNir Kaufman
 
NativeScript Developer Day Keynote - Todd Anglin & Burke Holland
NativeScript Developer Day Keynote - Todd Anglin & Burke HollandNativeScript Developer Day Keynote - Todd Anglin & Burke Holland
NativeScript Developer Day Keynote - Todd Anglin & Burke HollandBrian Rinaldi
 
Prototyping Mobile Apps with NativeScript and Angular
Prototyping Mobile Apps with NativeScript and AngularPrototyping Mobile Apps with NativeScript and Angular
Prototyping Mobile Apps with NativeScript and AngularMike Branstein
 
NativeScript: Cross-Platform Mobile Apps with JavaScript and Angular
NativeScript: Cross-Platform Mobile Apps with JavaScript and AngularNativeScript: Cross-Platform Mobile Apps with JavaScript and Angular
NativeScript: Cross-Platform Mobile Apps with JavaScript and AngularTodd Anglin
 
Global Azure Bootcamp Québec - Container on Azure
Global Azure Bootcamp Québec - Container on AzureGlobal Azure Bootcamp Québec - Container on Azure
Global Azure Bootcamp Québec - Container on AzureJulien Maitrehenry
 
Cross-Platform Mobile Development with Ionic Framework and Angular
Cross-Platform Mobile Development with Ionic Framework and AngularCross-Platform Mobile Development with Ionic Framework and Angular
Cross-Platform Mobile Development with Ionic Framework and AngularMovel
 
iPlayground: CarPlay and MFI Hearing Aids
iPlayground: CarPlay and MFI Hearing AidsiPlayground: CarPlay and MFI Hearing Aids
iPlayground: CarPlay and MFI Hearing AidsWeizhong Yang
 
Sinatra Heroku You And You - Keynote Format
Sinatra Heroku You And You - Keynote FormatSinatra Heroku You And You - Keynote Format
Sinatra Heroku You And You - Keynote FormatAdam Lowe
 
Sinatra Heroku You And You - PDF Format
Sinatra Heroku You And You - PDF FormatSinatra Heroku You And You - PDF Format
Sinatra Heroku You And You - PDF FormatAdam Lowe
 
React Native in a nutshell
React Native in a nutshellReact Native in a nutshell
React Native in a nutshellBrainhub
 
Automating PhoneGap Build
Automating PhoneGap BuildAutomating PhoneGap Build
Automating PhoneGap BuildMatt Gifford
 
HomeKitとNode.jsを使ってSiriでコントロールするなにか
HomeKitとNode.jsを使ってSiriでコントロールするなにかHomeKitとNode.jsを使ってSiriでコントロールするなにか
HomeKitとNode.jsを使ってSiriでコントロールするなにかkamiyam .
 
Rave in Context @ ApacheCon 2011
Rave in Context @ ApacheCon 2011Rave in Context @ ApacheCon 2011
Rave in Context @ ApacheCon 2011Sander van der Waal
 
Experiences building apps with React Native @DomCode 2016
Experiences building apps with React Native @DomCode 2016Experiences building apps with React Native @DomCode 2016
Experiences building apps with React Native @DomCode 2016Adrian Philipp
 
Cordova, Angularjs & Ionic @ Codeaholics
Cordova, Angularjs & Ionic @ CodeaholicsCordova, Angularjs & Ionic @ Codeaholics
Cordova, Angularjs & Ionic @ CodeaholicsEddie Lau
 
OSGi Community Event 2010 - Eclipse Virgo Update
OSGi Community Event 2010 - Eclipse Virgo UpdateOSGi Community Event 2010 - Eclipse Virgo Update
OSGi Community Event 2010 - Eclipse Virgo Updatemfrancis
 

What's hot (20)

Webpack and angularjs
Webpack and angularjsWebpack and angularjs
Webpack and angularjs
 
NativeScript Developer Day Keynote - Todd Anglin & Burke Holland
NativeScript Developer Day Keynote - Todd Anglin & Burke HollandNativeScript Developer Day Keynote - Todd Anglin & Burke Holland
NativeScript Developer Day Keynote - Todd Anglin & Burke Holland
 
Prototyping Mobile Apps with NativeScript and Angular
Prototyping Mobile Apps with NativeScript and AngularPrototyping Mobile Apps with NativeScript and Angular
Prototyping Mobile Apps with NativeScript and Angular
 
Why choose Angular 6?
Why choose Angular 6?Why choose Angular 6?
Why choose Angular 6?
 
NativeScript: Cross-Platform Mobile Apps with JavaScript and Angular
NativeScript: Cross-Platform Mobile Apps with JavaScript and AngularNativeScript: Cross-Platform Mobile Apps with JavaScript and Angular
NativeScript: Cross-Platform Mobile Apps with JavaScript and Angular
 
Global Azure Bootcamp Québec - Container on Azure
Global Azure Bootcamp Québec - Container on AzureGlobal Azure Bootcamp Québec - Container on Azure
Global Azure Bootcamp Québec - Container on Azure
 
Cross-Platform Mobile Development with Ionic Framework and Angular
Cross-Platform Mobile Development with Ionic Framework and AngularCross-Platform Mobile Development with Ionic Framework and Angular
Cross-Platform Mobile Development with Ionic Framework and Angular
 
Cordova 101
Cordova 101Cordova 101
Cordova 101
 
iPlayground: CarPlay and MFI Hearing Aids
iPlayground: CarPlay and MFI Hearing AidsiPlayground: CarPlay and MFI Hearing Aids
iPlayground: CarPlay and MFI Hearing Aids
 
Sinatra Heroku You And You - Keynote Format
Sinatra Heroku You And You - Keynote FormatSinatra Heroku You And You - Keynote Format
Sinatra Heroku You And You - Keynote Format
 
Sinatra Heroku You And You - PDF Format
Sinatra Heroku You And You - PDF FormatSinatra Heroku You And You - PDF Format
Sinatra Heroku You And You - PDF Format
 
React Native in a nutshell
React Native in a nutshellReact Native in a nutshell
React Native in a nutshell
 
Automating PhoneGap Build
Automating PhoneGap BuildAutomating PhoneGap Build
Automating PhoneGap Build
 
HomeKitとNode.jsを使ってSiriでコントロールするなにか
HomeKitとNode.jsを使ってSiriでコントロールするなにかHomeKitとNode.jsを使ってSiriでコントロールするなにか
HomeKitとNode.jsを使ってSiriでコントロールするなにか
 
Rave in Context @ ApacheCon 2011
Rave in Context @ ApacheCon 2011Rave in Context @ ApacheCon 2011
Rave in Context @ ApacheCon 2011
 
Experiences building apps with React Native @DomCode 2016
Experiences building apps with React Native @DomCode 2016Experiences building apps with React Native @DomCode 2016
Experiences building apps with React Native @DomCode 2016
 
Cordova, Angularjs & Ionic @ Codeaholics
Cordova, Angularjs & Ionic @ CodeaholicsCordova, Angularjs & Ionic @ Codeaholics
Cordova, Angularjs & Ionic @ Codeaholics
 
Intro to ionic 2
Intro to ionic 2Intro to ionic 2
Intro to ionic 2
 
OSGi Community Event 2010 - Eclipse Virgo Update
OSGi Community Event 2010 - Eclipse Virgo UpdateOSGi Community Event 2010 - Eclipse Virgo Update
OSGi Community Event 2010 - Eclipse Virgo Update
 
Swagger code motion talk
Swagger code motion talkSwagger code motion talk
Swagger code motion talk
 

Similar to Draper - Visnupriya - spriteXchange

Building Large Sustainable Apps
Building Large Sustainable AppsBuilding Large Sustainable Apps
Building Large Sustainable AppsBuğra Oral
 
Drupal Aware Design: Good Techniques for Better Themes
Drupal Aware Design: Good Techniques for Better ThemesDrupal Aware Design: Good Techniques for Better Themes
Drupal Aware Design: Good Techniques for Better Themesnyccamp
 
Refactoring Fat Models: Trying to be a Software Engineer
Refactoring Fat Models: Trying to be a Software EngineerRefactoring Fat Models: Trying to be a Software Engineer
Refactoring Fat Models: Trying to be a Software EngineerJyaasa Technologies
 
Markup Ain't Easy or: How I Learned to love An Object-Oriented RenderAPI
Markup Ain't Easy or: How I Learned to love An Object-Oriented RenderAPIMarkup Ain't Easy or: How I Learned to love An Object-Oriented RenderAPI
Markup Ain't Easy or: How I Learned to love An Object-Oriented RenderAPIc4rl
 
Decorator & Presenter Design Pattern
Decorator & Presenter Design PatternDecorator & Presenter Design Pattern
Decorator & Presenter Design PatternDonSchado
 
Draper presentation
Draper presentationDraper presentation
Draper presentationalexpeachey
 
Ottawa Puppet User Group - Publishing a Module on the Puppet Forge
Ottawa Puppet User Group - Publishing a Module on the Puppet ForgeOttawa Puppet User Group - Publishing a Module on the Puppet Forge
Ottawa Puppet User Group - Publishing a Module on the Puppet ForgeBill Fraser
 
The Modern Java Web Developer - Denver JUG 2013
The Modern Java Web Developer - Denver JUG 2013The Modern Java Web Developer - Denver JUG 2013
The Modern Java Web Developer - Denver JUG 2013Matt Raible
 
IncQuery Server for Teamwork Cloud - Talk at IW2019
IncQuery Server for Teamwork Cloud - Talk at IW2019IncQuery Server for Teamwork Cloud - Talk at IW2019
IncQuery Server for Teamwork Cloud - Talk at IW2019Istvan Rath
 
Reduce API Security Risk by Leveraging Graph Analytics Webinar Slides
Reduce API Security Risk by Leveraging Graph Analytics Webinar SlidesReduce API Security Risk by Leveraging Graph Analytics Webinar Slides
Reduce API Security Risk by Leveraging Graph Analytics Webinar SlidesNeo4j
 
Code refactor strategy part #1
Code refactor strategy part #1Code refactor strategy part #1
Code refactor strategy part #1Tracy LOISEL
 
SE2016 Java Alex Theedom "Java EE revisits design patterns"
SE2016 Java Alex Theedom "Java EE revisits design patterns"SE2016 Java Alex Theedom "Java EE revisits design patterns"
SE2016 Java Alex Theedom "Java EE revisits design patterns"Inhacking
 
Segue to design patterns
Segue to design patternsSegue to design patterns
Segue to design patternsRahul Singh
 
Beyond rails new
Beyond rails newBeyond rails new
Beyond rails newPaul Oguda
 
JFall 2016: Oracle JET Session
JFall 2016: Oracle JET SessionJFall 2016: Oracle JET Session
JFall 2016: Oracle JET SessionGeertjan Wielenga
 
GGX 2014 Lari Hotari Modular Monoliths with Spring Boot and Grails 3
GGX 2014 Lari Hotari Modular Monoliths with Spring Boot and Grails 3GGX 2014 Lari Hotari Modular Monoliths with Spring Boot and Grails 3
GGX 2014 Lari Hotari Modular Monoliths with Spring Boot and Grails 3Lari Hotari
 

Similar to Draper - Visnupriya - spriteXchange (20)

Building Large Sustainable Apps
Building Large Sustainable AppsBuilding Large Sustainable Apps
Building Large Sustainable Apps
 
Drupal Aware Design: Good Techniques for Better Themes
Drupal Aware Design: Good Techniques for Better ThemesDrupal Aware Design: Good Techniques for Better Themes
Drupal Aware Design: Good Techniques for Better Themes
 
Refactoring Fat Models: Trying to be a Software Engineer
Refactoring Fat Models: Trying to be a Software EngineerRefactoring Fat Models: Trying to be a Software Engineer
Refactoring Fat Models: Trying to be a Software Engineer
 
Markup Ain't Easy or: How I Learned to love An Object-Oriented RenderAPI
Markup Ain't Easy or: How I Learned to love An Object-Oriented RenderAPIMarkup Ain't Easy or: How I Learned to love An Object-Oriented RenderAPI
Markup Ain't Easy or: How I Learned to love An Object-Oriented RenderAPI
 
Decorator & Presenter Design Pattern
Decorator & Presenter Design PatternDecorator & Presenter Design Pattern
Decorator & Presenter Design Pattern
 
Draper presentation
Draper presentationDraper presentation
Draper presentation
 
Ottawa Puppet User Group - Publishing a Module on the Puppet Forge
Ottawa Puppet User Group - Publishing a Module on the Puppet ForgeOttawa Puppet User Group - Publishing a Module on the Puppet Forge
Ottawa Puppet User Group - Publishing a Module on the Puppet Forge
 
The Modern Java Web Developer - Denver JUG 2013
The Modern Java Web Developer - Denver JUG 2013The Modern Java Web Developer - Denver JUG 2013
The Modern Java Web Developer - Denver JUG 2013
 
2. intro to java
2. intro to java2. intro to java
2. intro to java
 
2. intro to java
2. intro to java2. intro to java
2. intro to java
 
IncQuery Server for Teamwork Cloud - Talk at IW2019
IncQuery Server for Teamwork Cloud - Talk at IW2019IncQuery Server for Teamwork Cloud - Talk at IW2019
IncQuery Server for Teamwork Cloud - Talk at IW2019
 
Reduce API Security Risk by Leveraging Graph Analytics Webinar Slides
Reduce API Security Risk by Leveraging Graph Analytics Webinar SlidesReduce API Security Risk by Leveraging Graph Analytics Webinar Slides
Reduce API Security Risk by Leveraging Graph Analytics Webinar Slides
 
Code refactor strategy part #1
Code refactor strategy part #1Code refactor strategy part #1
Code refactor strategy part #1
 
SE2016 Java Alex Theedom "Java EE revisits design patterns"
SE2016 Java Alex Theedom "Java EE revisits design patterns"SE2016 Java Alex Theedom "Java EE revisits design patterns"
SE2016 Java Alex Theedom "Java EE revisits design patterns"
 
Alex Theedom Java ee revisits design patterns
Alex Theedom	Java ee revisits design patternsAlex Theedom	Java ee revisits design patterns
Alex Theedom Java ee revisits design patterns
 
Segue to design patterns
Segue to design patternsSegue to design patterns
Segue to design patterns
 
Beyond rails new
Beyond rails newBeyond rails new
Beyond rails new
 
JFall 2016: Oracle JET Session
JFall 2016: Oracle JET SessionJFall 2016: Oracle JET Session
JFall 2016: Oracle JET Session
 
Imworld.ro
Imworld.roImworld.ro
Imworld.ro
 
GGX 2014 Lari Hotari Modular Monoliths with Spring Boot and Grails 3
GGX 2014 Lari Hotari Modular Monoliths with Spring Boot and Grails 3GGX 2014 Lari Hotari Modular Monoliths with Spring Boot and Grails 3
GGX 2014 Lari Hotari Modular Monoliths with Spring Boot and Grails 3
 

Recently uploaded

Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 

Recently uploaded (20)

Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 

Draper - Visnupriya - spriteXchange

  • 1. Draper Decorators/View-Models for Rails Applications Visnupriya. J .R 7th April 2014 @visnupriya90| github.com/visnupriya © Spritle Software Private Limited | http://www.spritle.com
  • 2. What is Draper? • object-oriented layer of presentation logic to your Rails application. • The idea of Draper is to provide real ruby class between the template and the model. • To decorate templates. © Spritle Software Private Limited | http://www.spritle.com
  • 3. Why use Draper? • Clean up complex view logic • Provides decorators which bundles view logic in an object oriented fashion • Easy to test than helpers • Code readability and easy to maintain • Code reuse © Spritle Software Private Limited | http://www.spritle.com
  • 4. What is Decorator Pattern? • It is a design pattern. • It allows behavior to be added to an individual object, either statically or dynamically, without affecting the behavior of other objects from the same class © Spritle Software Private Limited | http://www.spritle.com
  • 5. Let’s see how to use? • Add Draper to your Gemfile • Generate decorator for a model as shown below • rails generate decorator Article © Spritle Software Private Limited | http://www.spritle.com
  • 6. SAMPLE CODE Time to wakeup © Spritle Software Private Limited | http://www.spritle.com
  • 7. Questions? Thank you © Spritle Software Private Limited | http://www.spritle.com