SlideShare una empresa de Scribd logo
1 de 22
Descargar para leer sin conexión
RAILTIES
                                  OU


              COMO DESENVOLVER
            PLUGINS/GEMS PARA RAILS


    Carlos Antonio       blog.plataformatec.com.br   @cantoniodasilva
Sunday, November 6, 11
$ WHOAMI




    Carlos Antonio        blog.plataformatec.com.br   @cantoniodasilva
Sunday, November 6, 11
CARLOS ANTONIO DA SILVA

                         @cantoniodasilva


    Carlos Antonio           blog.plataformatec.com.br   @cantoniodasilva
Sunday, November 6, 11
BSI NA UNIDAVI - RIO DO SUL

      GP NO SENAC - RIO DO SUL/
           FLORIANÓPOLIS


    Carlos Antonio       blog.plataformatec.com.br   @cantoniodasilva
Sunday, November 6, 11
TRABALHO NA




    Carlos Antonio         blog.plataformatec.com.br   @cantoniodasilva
Sunday, November 6, 11
DEVISE




    Carlos Antonio       blog.plataformatec.com.br   @cantoniodasilva
Sunday, November 6, 11
SIMPLE_FORM




    Carlos Antonio         blog.plataformatec.com.br   @cantoniodasilva
Sunday, November 6, 11
RESPONDERS




    Carlos Antonio         blog.plataformatec.com.br   @cantoniodasilva
Sunday, November 6, 11
Railties

?

        Carlos Antonio       blog.plataformatec.com.br   @cantoniodasilva
    Sunday, November 6, 11
Railties

?
                                         WTF???
        Carlos Antonio       blog.plataformatec.com.br   @cantoniodasilva
    Sunday, November 6, 11
Initialization




           Application       Railties                    Engine

?
                               Generators


        Carlos Antonio       blog.plataformatec.com.br   @cantoniodasilva
    Sunday, November 6, 11
Initialization




?      HOOKS
           Application       Railties                    Engine




                               Generators


        Carlos Antonio       blog.plataformatec.com.br   @cantoniodasilva
    Sunday, November 6, 11
Railties GENERATORS Hooks

             module FooBar
               class Railtie < Rails::Railtie

                        config.generators.orm = :foo_bar

?              end
             end




        Carlos Antonio                 blog.plataformatec.com.br   @cantoniodasilva
    Sunday, November 6, 11
Railties                   RAKE TASKS                     Hooks
             module FooBar
               class Railtie < Rails::Railtie

                        rake_tasks do
                          load 'foo_bar/foo.rake'

?              end
                        end


             end




        Carlos Antonio                 blog.plataformatec.com.br    @cantoniodasilva
    Sunday, November 6, 11
Railties                            INIT                  Hooks
             module FooBar
               class Railtie < Rails::Railtie

                        # initialization hooks
                        config.before_configuration {}
                        config.before_eager_load {}


?
                        config.before_initialize {}
                        config.after_initialize {}
                        config.to_prepare {}

               end
             end



        Carlos Antonio                 blog.plataformatec.com.br    @cantoniodasilva
    Sunday, November 6, 11
Railties                            INIT                  Hooks
             module FooBar
               class Railtie < Rails::Railtie

                        initializer 'foo_bar.do_whatever' do |app|
                          puts "I'm initializing!"


?
                          # load your stuff here
                        end

               end
             end




        Carlos Antonio                 blog.plataformatec.com.br    @cantoniodasilva
    Sunday, November 6, 11
FRAMEWORK LOADING


                             ActiveSupport.on_load(:active_record) do
                               include FooBar::ActiveRecordExtensions
                             end

?

        Carlos Antonio                    blog.plataformatec.com.br   @cantoniodasilva
    Sunday, November 6, 11
E O QUE EU FAÇO COM
                      ESSE NEGÓCIO DE
                   FRAMEWORK LOADING?



    Carlos Antonio       blog.plataformatec.com.br   @cantoniodasilva
Sunday, November 6, 11
Railties                            INIT                  Hooks
             module FooBar
               class Railtie < Rails::Railtie

                        initializer 'foo_bar.do_whatever' do |app|
                          ActiveSupport.on_load(:active_record) do


?
                            include FooBar::ActiveRecordExtensions
                          end
                        end

               end
             end



        Carlos Antonio                 blog.plataformatec.com.br    @cantoniodasilva
    Sunday, November 6, 11
EXEMPLO REAL???




    Carlos Antonio           blog.plataformatec.com.br   @cantoniodasilva
Sunday, November 6, 11
module Responders
          autoload :FlashResponder,      'responders/flash_responder'
          autoload :HttpCacheResponder, 'responders/http_cache_responder'
          autoload :CollectionResponder, 'responders/collection_responder'

            require 'responders/controller_method'

            class Railtie < ::Rails::Railtie
              config.responders = ActiveSupport::OrderedOptions.new
              config.generators.scaffold_controller = :responders_controller

                # Add load paths straight to I18n, so engines and application can overwrite it.
                require 'active_support/i18n'
                I18n.load_path << File.expand_path('../responders/locales/en.yml', __FILE__)



?           initializer "responders.flash_responder" do |app|
              if app.config.responders.flash_keys
                Responders::FlashResponder.flash_keys = app.config.responders.flash_keys
              end
            end
          end
        end




        Carlos Antonio                    blog.plataformatec.com.br              @cantoniodasilva
    Sunday, November 6, 11
@cantoniodasilva
                         ?!       blog.plataformatec.com.br



                              Obrigado
                                     !


Sunday, November 6, 11

Más contenido relacionado

Último

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
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 2024Rafal Los
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
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
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
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 RobisonAnna Loughnan Colquhoun
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
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 2024The Digital Insurer
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
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 WorkerThousandEyes
 
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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
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
 
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...Drew Madelung
 
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 organizationRadu Cotescu
 

Último (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
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
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
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
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
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
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
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
 
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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
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
 
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...
 
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
 

Destacado

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Destacado (20)

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 

railties @ encontro guru sc (nao apresentado) - 2010.09.18

  • 1. RAILTIES OU COMO DESENVOLVER PLUGINS/GEMS PARA RAILS Carlos Antonio blog.plataformatec.com.br @cantoniodasilva Sunday, November 6, 11
  • 2. $ WHOAMI Carlos Antonio blog.plataformatec.com.br @cantoniodasilva Sunday, November 6, 11
  • 3. CARLOS ANTONIO DA SILVA @cantoniodasilva Carlos Antonio blog.plataformatec.com.br @cantoniodasilva Sunday, November 6, 11
  • 4. BSI NA UNIDAVI - RIO DO SUL GP NO SENAC - RIO DO SUL/ FLORIANÓPOLIS Carlos Antonio blog.plataformatec.com.br @cantoniodasilva Sunday, November 6, 11
  • 5. TRABALHO NA Carlos Antonio blog.plataformatec.com.br @cantoniodasilva Sunday, November 6, 11
  • 6. DEVISE Carlos Antonio blog.plataformatec.com.br @cantoniodasilva Sunday, November 6, 11
  • 7. SIMPLE_FORM Carlos Antonio blog.plataformatec.com.br @cantoniodasilva Sunday, November 6, 11
  • 8. RESPONDERS Carlos Antonio blog.plataformatec.com.br @cantoniodasilva Sunday, November 6, 11
  • 9. Railties ? Carlos Antonio blog.plataformatec.com.br @cantoniodasilva Sunday, November 6, 11
  • 10. Railties ? WTF??? Carlos Antonio blog.plataformatec.com.br @cantoniodasilva Sunday, November 6, 11
  • 11. Initialization Application Railties Engine ? Generators Carlos Antonio blog.plataformatec.com.br @cantoniodasilva Sunday, November 6, 11
  • 12. Initialization ? HOOKS Application Railties Engine Generators Carlos Antonio blog.plataformatec.com.br @cantoniodasilva Sunday, November 6, 11
  • 13. Railties GENERATORS Hooks module FooBar class Railtie < Rails::Railtie config.generators.orm = :foo_bar ? end end Carlos Antonio blog.plataformatec.com.br @cantoniodasilva Sunday, November 6, 11
  • 14. Railties RAKE TASKS Hooks module FooBar class Railtie < Rails::Railtie rake_tasks do load 'foo_bar/foo.rake' ? end end end Carlos Antonio blog.plataformatec.com.br @cantoniodasilva Sunday, November 6, 11
  • 15. Railties INIT Hooks module FooBar class Railtie < Rails::Railtie # initialization hooks config.before_configuration {} config.before_eager_load {} ? config.before_initialize {} config.after_initialize {} config.to_prepare {} end end Carlos Antonio blog.plataformatec.com.br @cantoniodasilva Sunday, November 6, 11
  • 16. Railties INIT Hooks module FooBar class Railtie < Rails::Railtie initializer 'foo_bar.do_whatever' do |app| puts "I'm initializing!" ? # load your stuff here end end end Carlos Antonio blog.plataformatec.com.br @cantoniodasilva Sunday, November 6, 11
  • 17. FRAMEWORK LOADING ActiveSupport.on_load(:active_record) do include FooBar::ActiveRecordExtensions end ? Carlos Antonio blog.plataformatec.com.br @cantoniodasilva Sunday, November 6, 11
  • 18. E O QUE EU FAÇO COM ESSE NEGÓCIO DE FRAMEWORK LOADING? Carlos Antonio blog.plataformatec.com.br @cantoniodasilva Sunday, November 6, 11
  • 19. Railties INIT Hooks module FooBar class Railtie < Rails::Railtie initializer 'foo_bar.do_whatever' do |app| ActiveSupport.on_load(:active_record) do ? include FooBar::ActiveRecordExtensions end end end end Carlos Antonio blog.plataformatec.com.br @cantoniodasilva Sunday, November 6, 11
  • 20. EXEMPLO REAL??? Carlos Antonio blog.plataformatec.com.br @cantoniodasilva Sunday, November 6, 11
  • 21. module Responders autoload :FlashResponder, 'responders/flash_responder' autoload :HttpCacheResponder, 'responders/http_cache_responder' autoload :CollectionResponder, 'responders/collection_responder' require 'responders/controller_method' class Railtie < ::Rails::Railtie config.responders = ActiveSupport::OrderedOptions.new config.generators.scaffold_controller = :responders_controller # Add load paths straight to I18n, so engines and application can overwrite it. require 'active_support/i18n' I18n.load_path << File.expand_path('../responders/locales/en.yml', __FILE__) ? initializer "responders.flash_responder" do |app| if app.config.responders.flash_keys Responders::FlashResponder.flash_keys = app.config.responders.flash_keys end end end end Carlos Antonio blog.plataformatec.com.br @cantoniodasilva Sunday, November 6, 11
  • 22. @cantoniodasilva ?! blog.plataformatec.com.br Obrigado ! Sunday, November 6, 11