SlideShare uma empresa Scribd logo
1 de 146
density!"!




Ruby on Rails
An Historical Introduction




Cleveland Web Sig                   June 19, 2010
Overview
Joe Fiorini
Rails Developer, Technology Evangelist, Husband, Dog
Lover
density!"!
Goals
Why to use Rails?
What’s Ruby and what’s Rails?
How does Rails make developers happy?
Where do I go for more information?
Assumptions
Assumptions
Basic HTTP knowledge
Assumptions
Basic HTTP knowledge
Basic object-oriented principles
Assumptions
Basic HTTP knowledge
Basic object-oriented principles
Dynamic web development
Assumptions
Basic HTTP knowledge
Basic object-oriented principles
Dynamic web development
SQL
#websigrails
For the Twits
Core Philosophy
DRY
Don’t Repeat Yourself
Convention Over Configuration
Get Started Faster!
REST
Your Application as an API
MVC
Model
Data Tier
View
Displayed to the user
Controller
Tying the model and view together
“
I'm trying to make Ruby natural,
not simple.



                     Yukihiro “Matz” Matsumoto
ActionPack
ActiveModel
ActionMailer
ActiveResource


ActiveSupport

Railties
ActionPack
ActiveModel
ActionMailer
ActiveResource


ActiveSupport

Railties
ActionPack
ActiveModel
ActionMailer
ActiveResource


ActiveSupport

Railties
ActionPack
ActiveModel
ActionMailer
ActiveResource


ActiveSupport

Railties
ActionPack
ActiveModel
ActionMailer
ActiveResource


ActiveSupport

Railties
ActionPack
ActiveModel
ActionMailer
ActiveResource


ActiveSupport

Railties
ActionPack
ActiveModel
ActionMailer
ActiveResource


ActiveSupport

Railties
ActionPack
ActiveModel
ActionMailer
ActiveResource


ActiveSupport

Railties
Life of a Request
http://www.densitypop.com/
ActionPack




             ActionDispatch
ActionPack



    Blog3::Application.routes.draw do |map|

     root :to => "posts#index"

    end
ActionPack




             ActionDispatch
ActionPack
 ActionDispatch
ActionPack
  ActionDispatch




                   ActionController
ActionPack
  ActionDispatch



       class PostsController < ApplicationController

        def index
         @posts = Post.order("created_at DESC").
                  limit(10)
        end

       end
ActionPack
  ActionDispatch                                   Inheritence

       class PostsController < ApplicationController


        def index
         @posts = Post.order("created_at DESC").
                  limit(10)
        end

       end
ActionPack
  ActionDispatch
                               Instance Method

             class PostsController < ApplicationController

              def index
               @posts = Post.order("created_at DESC").
                        limit(10)
              end

             end
ActionPack
  ActionDispatch
                            Instance Variable (field/private variable)

             class PostsController < ApplicationController

              def index
                 @posts
                    = Post.order("created_at DESC").
                        limit(10)
              end

             end
ActionPack
  ActionDispatch
                    Class                   Class method (static)

             class PostsController < ApplicationController

              def index
               @posts =     Post.order("created_at DESC").
                               limit(10)
              end

             end
ActionPack
  ActionDispatch




                   ActionController
ActionPack
  ActionDispatch   ActionController
ActiveModel
  ActionDispatch         ActionController




                   ActiveRecord
ActiveRecord




                  SQLite/
                  MySQL/
               PostgreSQL/…
ActiveRecord

                    SQLite/
                    MySQL/
                   MongoDB/…




                       posts
               id
               title
               body
ActiveRecord

               SQLite/
               MySQL/
              MongoDB/…




                  posts
          id              Post
          title
          body
ActiveRecord




    class Post < ActiveRecord::Base
    end
ActiveRecord



    post.title
    post.body
    post.id

    post.save
    post.destroy
ActiveRecord




    Post.find_by_title "Awesomest post ever!"

    SELECT * FROM posts WHERE title = 'Awesomest post ever!'
ActiveRecord




    Post.where("title = 'Awesomest post ever!'")

    SELECT * FROM posts WHERE title = 'Awesomest post ever!'
ActiveRecord



    Post.joins(:authors).where("authors.name = 'Joe'")

    SELECT * FROM posts INNER JOIN authors ON
      posts.author_id = authors.id
      WHERE authors.author_name = 'Joe'
ActiveRecord



    Post.find_by_title "Awesomest post ever!"

    vs.
    Post.where("title = 'Awesomest post ever!'")
ActiveRecord
    class CreatePosts < ActiveRecord::Migration
     def self.up
       create_table :posts do |t|
        t.string :title
        t.text :body

       t.timestamps
      end
     end

     def self.down
      drop_table :posts
     end
    end
ActiveRecord


    Validations
      validates_presence_of
      validates_uniqueness_of
      validates_format_of
      validates_length_of
      …
ActiveRecord




    http://guides.rails.info
    RTFM
ActiveModel
  ActionDispatch             ActionController




       class Post < ActiveRecord::Base
       end
ActiveModel
  ActionDispatch         ActionController




                   ActiveRecord
ActiveModel
  ActionDispatch   ActionController

                   ActiveRecord
ActionPack
  ActionDispatch         ActionController

                         ActiveRecord




                   ActionView
ActionPack
  ActionDispatch             ActionController

                             ActiveRecord

       <ol>

        <% @posts.each do |post| %>

         <li class="post">

           <h2><%= link_to post.title, post %></h2>
           <span><%= post.body %></span>

         </li>

        <% end %>

       </ol>
ActionPack
  ActionDispatch             Iterator (for loop)
                              ActionController

                             ActiveRecord

       <ol>



        <% @posts.each do |post| %>

         <li class="post">

           <h2><%= link_to post.title, post %></h2>
           <span><%= post.body %></span>

         </li>

        <% end %>
       </ol>
ActionPack
Block (anonymous function)
  ActionDispatch             ActionController

                             ActiveRecord        Block parameter
       <ol>

        <% @posts.each do |post| %>
                  do |post| %>
         <li class="post">

           <h2><%= link_to post.title, post %></h2>
           <span><%= post.body %></span>

         </li>

        <% end %>
        <% end %>
       </ol>
ActionPack
  ActionDispatch             ActionController

                             ActiveRecord


Helper method
    <ol>

        <% @posts.each do |post| %>

         <li class="post">

           <h2>                   </h2>
           <span><%= post.body %></span> %>
                 <%= link_to post.title, post
         </li>

        <% end %>

       </ol>
ActionPack
  ActionDispatch             ActionController

                             ActiveRecord


Helper method
    <ol>

        <% @posts.each do |post| %>

         <li class="post">

           <h2>                   </h2>
           <span><%= post.body %></span> %>
                 <%= link_to post.title, post
         </li>

        <% end %> <a href="...">Post Title</a>

       </ol>
ActionPack
  ActionDispatch         ActionController

                         ActiveRecord




                   ActionView
ActionPack
  ActionDispatch   ActionController   ActionView

                   ActiveRecord


       <html>
       ...
       </html>
http://densitypop.com/posts/22
ActionPack




             ActionDispatch
ActionPack



    Blog3::Application.routes.draw do |map|

     resources :posts

    end
GET /posts/new
Post#new
POST /posts
Post#create
GET /posts/edit/22
Post#edit
PUT /post/22
Post#update
GET /posts/22
Post#show
DELETE /posts/22
Post#destroy
ActionPack




             ActionDispatch
ActionPack
 ActionDispatch
ActionPack
  ActionDispatch




                   ActionController
ActionPack
  ActionDispatch




      class PostsController < ApplicationController

        def show
         @post = Post.find(params[:id])
        end

      end
ActionPack
  ActionDispatch

 Request Parameter Hash

       class PostsController < ApplicationController

        def show
         @post = Post.find(       )
        end                     params[:id]

       end
ActionPack
  ActionDispatch




                   ActionController
ActionPack
  ActionDispatch   ActionController
ActiveModel
  ActionDispatch         ActionController




                   ActiveRecord
ActiveModel
  ActionDispatch             ActionController




       class Post < ActiveRecord::Base
       end
ActiveModel
  ActionDispatch         ActionController




                   ActiveRecord
ActiveModel
  ActionDispatch   ActionController

                   ActiveRecord
ActionPack
  ActionDispatch         ActionController

                         ActiveRecord




                   ActionView
ActionPack
  ActionDispatch            ActionController

                            ActiveRecord




       <h1><%= link_to @post.title, @post %></h1>
       <span><%= @post.body %></span>
ActionPack
  ActionDispatch         ActionController

                         ActiveRecord




                   ActionView
ActionPack
  ActionDispatch   ActionController   ActionView

                   ActiveRecord


       <html>
       ...
       </html>
http://densitypop.com/feed.xml
ActionPack




             ActionDispatch
ActionPack



    Blog3::Application.routes.draw do |map|

     match 'feed.xml', :to => 'posts#index'

    end
ActionPack




             ActionDispatch
ActionPack
 ActionDispatch
ActionPack
  ActionDispatch




                   ActionController
ActionPack
  ActionDispatch


      class PostsController < ApplicationController
       respond_to :xml

        def index
         respond_with(@posts = Post.
                      order("created_at DESC").
                      limit(10))
        end

      end
ActionPack
  ActionDispatch




                   ActionController
ActionPack
  ActionDispatch   ActionController
ActiveModel
  ActionDispatch         ActionController




                   ActiveRecord
ActiveModel
  ActionDispatch             ActionController




       class Post < ActiveRecord::Base
       end
ActiveModel
  ActionDispatch         ActionController




                   ActiveRecord
ActiveModel
  ActionDispatch   ActionController

                   ActiveRecord
ActionPack
  ActionDispatch         ActionController

                         ActiveRecord




                   ActionView
ActionPack
  ActionDispatch              ActionController

                              ActiveRecord


       atom_feed do |feed|
        feed.title("Joe's Awesome Blog!")
        feed.updated(@posts.first.created_at)

        @posts.each do |post|
         feed.entry(post) do |entry|
          entry.title(post.title)
          entry.content(post.body, :type => 'html')
          entry.author { |author| author.name("Joe") }
         end
        end

       end
http://densitypop.com/posts.json
ActionPack




             ActionDispatch
ActionPack



    Blog3::Application.routes.draw do |map|

     resources :posts

    end
ActionPack




             ActionDispatch
ActionPack
 ActionDispatch
ActionPack
  ActionDispatch




                   ActionController
ActionPack
  ActionDispatch


      class PostsController < ApplicationController
       respond_to :xml, :json

        def index
         respond_with(@posts = Post.
                      order("created_at DESC").
                      limit(10))
        end

      end
ActionPack
  ActionDispatch




                   ActionController
ActionPack
  ActionDispatch   ActionController
ActiveModel
  ActionDispatch         ActionController




                   ActiveRecord
ActiveModel
  ActionDispatch             ActionController




       class Post < ActiveRecord::Base
       end
ActiveModel
  ActionDispatch         ActionController




                   ActiveRecord
ActiveModel
  ActionDispatch   ActionController

                   ActiveRecord
ActionPack
  ActionDispatch         ActionController

                         ActiveRecord




                   ActionView
ActionPack
  ActionDispatch                 ActionController

                                 ActiveRecord




       [This slide intentionally left blank]
There you go.
Isn’t that easy?
Digging Deeper
Nothing is Sacred
Anything can be overridden
Not all magic
Some illusions too
Enterprise Ready
http://www.workingwithrails.com/high-profile-organisations
http://bit.ly/websigrailslinks
Resources


            http://bit.ly/websigrailslinks
Cleveland Ruby Brigade
http://www.meetup.com/ClevelandRuby




                         http://bit.ly/websigrailslinks
Agile Web Dev. with Rails
http://pragprog.com/titles/rails4/




                              http://bit.ly/websigrailslinks
Rails 3 in Action
http://www.manning.com/katz/




                          http://bit.ly/websigrailslinks
http://bit.ly/websigrailslinks
The End
http://speakerrate.com/joefiorini
Please rate this talk (only if it’s good)!

Mais conteúdo relacionado

Mais procurados

Distributed Ruby and Rails
Distributed Ruby and RailsDistributed Ruby and Rails
Distributed Ruby and Rails
Wen-Tien Chang
 

Mais procurados (20)

[2015/2016] Local data storage for web-based mobile apps
[2015/2016] Local data storage for web-based mobile apps[2015/2016] Local data storage for web-based mobile apps
[2015/2016] Local data storage for web-based mobile apps
 
Angular JS
Angular JSAngular JS
Angular JS
 
Jsp
JspJsp
Jsp
 
Jsp
JspJsp
Jsp
 
Ruby on Rails: Coding Guideline
Ruby on Rails: Coding GuidelineRuby on Rails: Coding Guideline
Ruby on Rails: Coding Guideline
 
Java Server Pages
Java Server PagesJava Server Pages
Java Server Pages
 
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory CourseRuby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
 
Spring Mvc Rest
Spring Mvc RestSpring Mvc Rest
Spring Mvc Rest
 
Laravel 8 export data as excel file with example
Laravel 8 export data as excel file with exampleLaravel 8 export data as excel file with example
Laravel 8 export data as excel file with example
 
JavaScript - Chapter 7 - Advanced Functions
 JavaScript - Chapter 7 - Advanced Functions JavaScript - Chapter 7 - Advanced Functions
JavaScript - Chapter 7 - Advanced Functions
 
REST APIs in Laravel 101
REST APIs in Laravel 101REST APIs in Laravel 101
REST APIs in Laravel 101
 
Implicit object.pptx
Implicit object.pptxImplicit object.pptx
Implicit object.pptx
 
Jsp presentation
Jsp presentationJsp presentation
Jsp presentation
 
jQuery - Chapter 3 - Effects
jQuery - Chapter 3 - Effects  jQuery - Chapter 3 - Effects
jQuery - Chapter 3 - Effects
 
Jsp element
Jsp elementJsp element
Jsp element
 
jQuery
jQueryjQuery
jQuery
 
JSP - Java Server Page
JSP - Java Server PageJSP - Java Server Page
JSP - Java Server Page
 
Web Applications and Deployment
Web Applications and DeploymentWeb Applications and Deployment
Web Applications and Deployment
 
Data Access with JDBC
Data Access with JDBCData Access with JDBC
Data Access with JDBC
 
Distributed Ruby and Rails
Distributed Ruby and RailsDistributed Ruby and Rails
Distributed Ruby and Rails
 

Semelhante a An Introduction to Ruby on Rails

Overview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web FrameworkOverview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web Framework
IndicThreads
 
Scala based Lift Framework
Scala based Lift FrameworkScala based Lift Framework
Scala based Lift Framework
vhazrati
 
Rails 3 overview
Rails 3 overviewRails 3 overview
Rails 3 overview
Yehuda Katz
 
Rails 3: Dashing to the Finish
Rails 3: Dashing to the FinishRails 3: Dashing to the Finish
Rails 3: Dashing to the Finish
Yehuda Katz
 

Semelhante a An Introduction to Ruby on Rails (20)

Rails is not just Ruby
Rails is not just RubyRails is not just Ruby
Rails is not just Ruby
 
Overview Of Lift Framework
Overview Of Lift FrameworkOverview Of Lift Framework
Overview Of Lift Framework
 
Overview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web FrameworkOverview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web Framework
 
Scala based Lift Framework
Scala based Lift FrameworkScala based Lift Framework
Scala based Lift Framework
 
Rails 3 overview
Rails 3 overviewRails 3 overview
Rails 3 overview
 
Ruby/Rails
Ruby/RailsRuby/Rails
Ruby/Rails
 
WordPress as the Backbone(.js)
WordPress as the Backbone(.js)WordPress as the Backbone(.js)
WordPress as the Backbone(.js)
 
Rails 3: Dashing to the Finish
Rails 3: Dashing to the FinishRails 3: Dashing to the Finish
Rails 3: Dashing to the Finish
 
Rails vs Web2py
Rails vs Web2pyRails vs Web2py
Rails vs Web2py
 
Pourquoi ruby et rails déchirent
Pourquoi ruby et rails déchirentPourquoi ruby et rails déchirent
Pourquoi ruby et rails déchirent
 
Introduction à Ruby
Introduction à RubyIntroduction à Ruby
Introduction à Ruby
 
jQuery
jQueryjQuery
jQuery
 
Rich Portlet Development in uPortal
Rich Portlet Development in uPortalRich Portlet Development in uPortal
Rich Portlet Development in uPortal
 
Taming Core Data by Arek Holko, Macoscope
Taming Core Data by Arek Holko, MacoscopeTaming Core Data by Arek Holko, Macoscope
Taming Core Data by Arek Holko, Macoscope
 
jQuery and Rails: Best Friends Forever
jQuery and Rails: Best Friends ForeverjQuery and Rails: Best Friends Forever
jQuery and Rails: Best Friends Forever
 
React
React React
React
 
Ride on the Fast Track of Web with Ruby on Rails- Part 2
Ride on the Fast Track of Web with Ruby on Rails- Part 2Ride on the Fast Track of Web with Ruby on Rails- Part 2
Ride on the Fast Track of Web with Ruby on Rails- Part 2
 
What's new in Rails 4
What's new in Rails 4What's new in Rails 4
What's new in Rails 4
 
Let's react - Meetup
Let's react - MeetupLet's react - Meetup
Let's react - Meetup
 
Associations & JavaScript
Associations & JavaScriptAssociations & JavaScript
Associations & JavaScript
 

Último

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
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
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 

An Introduction to Ruby on Rails

Notas do Editor

  1. TAKE IT SLOW Pause after topics Take some deep breaths Walk to other side of projector when pausing
  2. Within3
  3. - Ecommerce Sites on Shopify - iPad/iPhone R&amp;D - Consulting
  4. - Ecommerce Sites on Shopify - iPad/iPhone R&amp;D - Consulting
  5. If I throw out a term that you don&amp;#x2019;t understand, please feel free to ask!
  6. If I throw out a term that you don&amp;#x2019;t understand, please feel free to ask!
  7. If I throw out a term that you don&amp;#x2019;t understand, please feel free to ask!
  8. If I throw out a term that you don&amp;#x2019;t understand, please feel free to ask!
  9. Write once, use everywhere Code is easier to consume Easier to edit later
  10. How many have not used MVC? It&amp;#x2019;s up to you to architect and organize your code in those tools. Rails makes that decision for you by implementing MVC.
  11. Code driving the UI that gets displayed to the user
  12. Interacts with model and sends the data to the view
  13. - Open source framework for developing web applications - Created by David Heinemeier Hansson - 1.0 was an extremely opinionated framework - 3.0 allows you to change many of the opinions &amp;#x2026;Written in the language
  14. - Everything has a type, but the language infers types at runtime instead of you specifying them up front
  15. Remembering names is not important; knowing how the pieces fit together &amp; interact is
  16. Utility collection and standard Ruby core extensions used both by Rails itself and your application
  17. The glue; ties together framework libraries and 3rd party plugins
  18. Build an application through the life of an HTTP request
  19. - List 10 most recent posts, newest first
  20. ...since for most of you this is your first time seeing Ruby code, let&amp;#x2019;s look at this a little bit
  21. any instance variables in a controller are automatically handed into the view
  22. ...since for most of you this is your first time seeing Ruby code, let&amp;#x2019;s look at this a little bit
  23. ActiveRecord is.... Default option, but you can use any ORM that implements ActiveModel
  24. Inheriting from ActiveRecord::Base does some pretty cool things for us
  25. Because I have a class called Post AR knows to look up... it also gives us some more time saving methods like...
  26. find_by_title will call SQL right away .where (and other query methods) will delegate the SQL call to the first time the array is used
  27. Way to go forward and backwards between versions of your database
  28. We didn&amp;#x2019;t have to write a single line of data access code
  29. &amp;#x2026;here&amp;#x2019;s some more strange Ruby syntax
  30. this helper method generates the html for a link
  31. this helper method generates the html for a link
  32. &amp;#x2026;this generates a number of helpful routes for us
  33. ...since for most of you this is your first time seeing Ruby code, let&amp;#x2019;s look at this a little bit
  34. params[:id] comes from resources route
  35. ActiveRecord is.... Default option, but you can use any ORM that implements ActiveModel
  36. We still haven&amp;#x2019;t written a single line of data access code
  37. &amp;#x2026;here&amp;#x2019;s some more strange Ruby syntax
  38. &amp;#x2026;this generates a number of helpful routes for us
  39. ...since for most of you this is your first time seeing Ruby code, let&amp;#x2019;s look at this a little bit
  40. ActiveRecord is.... Default option, but you can use any ORM that implements ActiveModel
  41. We still haven&amp;#x2019;t written a single line of data access code
  42. With builder all of our block parameters become parent XML tags and all of our method calls child tags; we define attributes by passing a hash to a tag method &amp;#x2026;what if we wanted to enable easy Javascript interaction?
  43. &amp;#x2026;this generates a number of helpful routes for us
  44. ...since for most of you this is your first time seeing Ruby code, let&amp;#x2019;s look at this a little bit
  45. ActiveRecord is.... Default option, but you can use any ORM that implements ActiveModel
  46. We still haven&amp;#x2019;t written a single line of data access code
  47. respond_with tells ActionController to format the object if it can Rails can convert any object into JSON
  48. We&amp;#x2019;ve barely scratched the surface of what Rails can do.
  49. Convention is very powerful, but sometimes it makes sense to override the defaults
  50. Rails gets most of its flexibility from the Ruby language. Uses &amp;#x201C;metaprogramming&amp;#x201D; to generate code at runtime. Optimized for the best of productivity &amp; performance.
  51. You&amp;#x2019;d be surprised to see who&amp;#x2019;s using Rails.
  52. Highly recommend some further reading to get a better feel for how you can make Rails work for you.
  53. ...in case you missed it