SlideShare uma empresa Scribd logo
1 de 50
Baixar para ler offline
POURQUOI RUBY ET RAILS
     DÉCHIRENT !
       Par Nicolas Ledez
RUBY 1/3

• Interprété

• Objet

• Multiparadigme

• Multiplateforme

• Libre, gratuit, etc
RUBY 2/3

• Ramasse-miettes

• Gestion   d'exceptions

• Expressions   rationnelles (Regexp)

• Blocs

• Extensions   en C
RUBY 3/3


• Héritage   simple

• Mixin   -> « héritage multiple »

• Réflexion

• Crée    en 1995
VIRTUAL MACHINE

• Matz's   Ruby Interpreter – Cruby

• JRuby

• Rubinius

• MacRuby

• mruby

• RubyMotion
AUTOUR DU LANGAGE
POUR LES DEV

• Rspec, Cucumber, Minitest, ...

• HAML, SASS, Compass, ...

• Pow, Spork, Guard, ...

• Bundler, RVM, Rbenv, Pik, ...

• Rails, Sinatra, ...

• Vagrant
POUR LA PRODUCTION


• Unicorn, Passenger, ...

• Capistrano, Pupetts, Chef, ...

• Graylog2, God, ...
POUR LES DEV


• Cucumber

• Guard, SASS, Compass, ...

• Vagrant

• Graylog2, God, ...
ET ENCORE...



•+   de 43 667 gems sur RubyGems.org

• ruby-toolbox.com
RAILS


      json         Rack

         Uglifier

                   i18n
ERB                       ActiveRecord
MV C
M odel View C ontroller
OR M
Object R elational Mapping
ACTIVE RECORD
                articles
id      title                  body
1    hello world           This is a body




                                    # app/models/article.rb
                                    class Article < ActiveRecord::Base
                                    end

                                    article = Article.first

                                    article.title
                                    #=> "hello world"
ACTIVE RECORD
                    articles
id      title          body              published
1    hello world   This is a body           1
2    other art.    Not published            0




                               articles = Article.where(published: 1)

                               articles.count
                               #=> 1
CONFIGURATION
Conventions
CONFIGURATION
ACTIVE RECORD
                    articles
id        title        body    author_id
                                           # app/models/article.rb
1          ...           ...      1        class Article < ActiveRec...
                                             belongs_to :author
                                           end

                                           # app/models/author.rb
                                           class Author < ActiveRec...
          authors                            has_many :articles
     id           name                     end
     1           John Doe
                                           article = Article.first

                                           article.author.name
                                           #=> “John Doe”
ACTIVE RECORD

  MySQL
  PostgreSQL
  SQLite
  ...
ROUTING
# app/controller/hello_controller.rb
class HelloController < ApplicationController
  def index
    @name = params[:name]
  end
end

             http://example.com/hello/John

    # config/routes.rb
    get "hello/:name" => "hello#index"


                                             action du contrôleur
             URL
                                contrôleur
        verbe HTTP
                         paramètre
VUES
# app/controller/hello_controller.rb
class HelloController < ApplicationController
  def index
    @name = params[:name]
  end
end


# app/views/hello/index.html.erb
Bonjour <%= @name %>




                    Conventions !
HELPERS
# app/controller/articles_controller.rb
class ArticlesController < ApplicationController
  def new
    @article = Article.new
  end
end

 Title                 <%= form_for @article do |f| %>
                         <p><%= f.label :title, "Title" %><br />
                            <%= f.text_field :title %></p>
 Body                    <p><%= f.label :body, "Body" %><br />
                            <%= f.text_area :body %></p>

                         <p><%= f.submit %></p>
                       <% end %>
 Create Article
RAILTIES
$ rake routes
GET /hello/:name   { :controller => "hello", :action => "index" }

$ rails server
Lance un serveur web sur http://localhost:3000/

$ rails console
Lance une console avec le contexte de l’application
  >> Article.first.title
  #=> "hello world"
GÉNÉRATEURS
$ rails generate model author name:string
  invoke active_record
      create db/migrate/20120108151543_create_authors.rb
      create app/models/author.rb



     instructions de création de la table authors


    modèle Author
GÉNÉRATEURS
$ rails g scaffold author name:string
create   db/migrate/20120108152723_create_authors.rb
create   app/models/author.rb                                  modèle
route    resources :authors                      routes
create   app/controllers/authors_controller.rb
                                                          contrôleur
create   app/views/authors/index.html.erb
create   app/views/authors/edit.html.erb
create   app/views/authors/show.html.erb
create   app/views/authors/new.html.erb                    vues
create   app/views/authors/_form.html.erb

create   public/stylesheets/scaffold.css

                                           CSS par défaut
GÉNÉRATEURS
 # config/routes.rb
 resources :authors

   authors       GET /authors            {   action:   index     controller:   authors   }
   author        GET /authors/:id        {   action:   show      controller:   authors   }
   new_author    GET /authors/new        {   action:   new       controller:   authors   }
                 POST /authors           {   action:   create    controller:   authors   }
   edit_author   GET /authors/:id/edit   {   action:   edit      controller:   authors   }
                 PUT /authors/:id        {   action:   update    controller:   authors   }
                 DELETE /authors/:id     {   action:   destroy   controller:   authors   }




<%= link_to "All authors", authors_path %>
<%= link_to "Edit", edit_author_path(@author) %>
GÉNÉRATEURS
GÉNÉRATEURS
GÉNÉRATEURS
GÉNÉRATEURS
GÉNÉRATEURS
GÉNÉRATEURS
GÉNÉRATEURS
GÉNÉRATEURS
LES PETITS PLUS
         D’ACTIVESUPPORT
1.kilobytes!   #=> 1024


3.days.ago!!   #=> Sat, 04 Feb 2012 17:45:42 CET +01:00


"héhé test".parameterize! #=> "hehe-test"


“article”.pluralize! ! ! #=> "articles"
                   !
EXTENSIBILITÉ
  Grâce aux Gems
VUES ET FORMULAIRES
<%= form_for @article do |f| %>
  <p><%= f.label :title, "Title" %><br />
     <%= f.text_field :title %></p>

  <p><%= f.label :body, "Body" %><br />
     <%= f.text_area :body %></p>

  <p><%= f.submit %></p>
<% end %>                             slim + simple_form


                             = simple_form_for @article do |f|
                                = f.input :title
                                = f.input :body
                                = f.submit
ET TANT D’AUTRES
Mongoid                Pagination
     MongoDB                        Kaminari


  Carierwave           Système d’administration

  Upload de fichiers            Active Admin
QUI UTILISE RAILS ?
 Twitter
                                  Github
               Basecamp

Pages Jaunes US
                             Groupon

     Shopify

                  http://rubyonrails.org/applications
J’INSTALLE TOUT ÇA
     COMMENT ?
JRUBY
LES RESSOURCES
ESSAYER EN LIGNE


• tryruby.org

• rubykoans.com

• rubymonk.com

• railsforzombies.org
POUR APPRENDRE

• hackety.com

• ruby.railstutorial.org

• railscasts.com

• jasimabasheer.com/posts/
 meta_introduction_to_ruby.html

• www.pierreschambacher.com/blog/lectures-pour-
 apprendre-ruby-et-rails/
A SUIVRE

• nicolas.ledez.net   @nledez

• organicweb.fr   @organicweb

• camilleroux.com     @CamilleRoux

• matthieusegret.com     @MatthieuSegret

• news.humancoders.com       @Human_Coders

• @brmichel   (http://linuxfr.org/)
LA COMMUNAUTÉE

• Apéros   Ruby

• rubyfrance.org

• railsfrance.org

• Google   groups:

• Rennes   on Rails

• Railsfrance
UN GRAND MERCI


•A   Simon Courtois

• @happynoff

• Pour   ses slides :

•   http://blog.happynoff.fr/post/pourquoi-ruby-on-rails-ca-dechire

Mais conteúdo relacionado

Mais procurados

More to RoC weibo
More to RoC weiboMore to RoC weibo
More to RoC weiboshaokun
 
Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
 Connecting Content Silos: One CMS, Many Sites With The WordPress REST API Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
Connecting Content Silos: One CMS, Many Sites With The WordPress REST APICaldera Labs
 
REST APIs in Laravel 101
REST APIs in Laravel 101REST APIs in Laravel 101
REST APIs in Laravel 101Samantha Geitz
 
Building Cloud Castles
Building Cloud CastlesBuilding Cloud Castles
Building Cloud CastlesBen Scofield
 
Introduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress DevelopersIntroduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress DevelopersCaldera Labs
 
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...Caldera Labs
 
Rails web api 开发
Rails web api 开发Rails web api 开发
Rails web api 开发shaokun
 
Introduction To Django (Strange Loop 2011)
Introduction To Django (Strange Loop 2011)Introduction To Django (Strange Loop 2011)
Introduction To Django (Strange Loop 2011)Jacob Kaplan-Moss
 
Ruby MVC from scratch with Rack
Ruby MVC from scratch with RackRuby MVC from scratch with Rack
Ruby MVC from scratch with RackDonSchado
 
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...Building Modern and Secure PHP Applications – Codementor Office Hours with Be...
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...Arc & Codementor
 
Ruby on Rails - Introduction
Ruby on Rails - IntroductionRuby on Rails - Introduction
Ruby on Rails - IntroductionVagmi Mudumbai
 
OSGi, Scripting and REST, Building Webapps With Apache Sling
OSGi, Scripting and REST, Building Webapps With Apache SlingOSGi, Scripting and REST, Building Webapps With Apache Sling
OSGi, Scripting and REST, Building Webapps With Apache SlingCarsten Ziegeler
 
How to develop modern web application framework
How to develop modern web application frameworkHow to develop modern web application framework
How to develop modern web application frameworktechmemo
 
Layouts and Rendering in Rails, Season 2
Layouts and Rendering in Rails, Season 2Layouts and Rendering in Rails, Season 2
Layouts and Rendering in Rails, Season 2RORLAB
 
Sinatra Rack And Middleware
Sinatra Rack And MiddlewareSinatra Rack And Middleware
Sinatra Rack And MiddlewareBen Schwarz
 
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3makoto tsuyuki
 
優しいWAFの作り方
優しいWAFの作り方優しいWAFの作り方
優しいWAFの作り方techmemo
 
4Developers: Michał Papis- Publikowanie gemów
4Developers: Michał Papis- Publikowanie gemów4Developers: Michał Papis- Publikowanie gemów
4Developers: Michał Papis- Publikowanie gemówPROIDEA
 
Introducing Assetic: Asset Management for PHP 5.3
Introducing Assetic: Asset Management for PHP 5.3Introducing Assetic: Asset Management for PHP 5.3
Introducing Assetic: Asset Management for PHP 5.3Kris Wallsmith
 

Mais procurados (20)

More to RoC weibo
More to RoC weiboMore to RoC weibo
More to RoC weibo
 
Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
 Connecting Content Silos: One CMS, Many Sites With The WordPress REST API Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
 
REST APIs in Laravel 101
REST APIs in Laravel 101REST APIs in Laravel 101
REST APIs in Laravel 101
 
Building Cloud Castles
Building Cloud CastlesBuilding Cloud Castles
Building Cloud Castles
 
Introduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress DevelopersIntroduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress Developers
 
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
 
Rails web api 开发
Rails web api 开发Rails web api 开发
Rails web api 开发
 
Introduction To Django (Strange Loop 2011)
Introduction To Django (Strange Loop 2011)Introduction To Django (Strange Loop 2011)
Introduction To Django (Strange Loop 2011)
 
Ruby MVC from scratch with Rack
Ruby MVC from scratch with RackRuby MVC from scratch with Rack
Ruby MVC from scratch with Rack
 
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...Building Modern and Secure PHP Applications – Codementor Office Hours with Be...
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...
 
Ruby on Rails - Introduction
Ruby on Rails - IntroductionRuby on Rails - Introduction
Ruby on Rails - Introduction
 
OSGi, Scripting and REST, Building Webapps With Apache Sling
OSGi, Scripting and REST, Building Webapps With Apache SlingOSGi, Scripting and REST, Building Webapps With Apache Sling
OSGi, Scripting and REST, Building Webapps With Apache Sling
 
Javascript laravel's friend
Javascript laravel's friendJavascript laravel's friend
Javascript laravel's friend
 
How to develop modern web application framework
How to develop modern web application frameworkHow to develop modern web application framework
How to develop modern web application framework
 
Layouts and Rendering in Rails, Season 2
Layouts and Rendering in Rails, Season 2Layouts and Rendering in Rails, Season 2
Layouts and Rendering in Rails, Season 2
 
Sinatra Rack And Middleware
Sinatra Rack And MiddlewareSinatra Rack And Middleware
Sinatra Rack And Middleware
 
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
 
優しいWAFの作り方
優しいWAFの作り方優しいWAFの作り方
優しいWAFの作り方
 
4Developers: Michał Papis- Publikowanie gemów
4Developers: Michał Papis- Publikowanie gemów4Developers: Michał Papis- Publikowanie gemów
4Developers: Michał Papis- Publikowanie gemów
 
Introducing Assetic: Asset Management for PHP 5.3
Introducing Assetic: Asset Management for PHP 5.3Introducing Assetic: Asset Management for PHP 5.3
Introducing Assetic: Asset Management for PHP 5.3
 

Destaque

Apresentação destinos: Lisboa, Madri, Paris com Fátima, Lourdes e Castelos do...
Apresentação destinos: Lisboa, Madri, Paris com Fátima, Lourdes e Castelos do...Apresentação destinos: Lisboa, Madri, Paris com Fátima, Lourdes e Castelos do...
Apresentação destinos: Lisboa, Madri, Paris com Fátima, Lourdes e Castelos do...Urbi et Orbi
 
Economic alliance health care reform update march 5-2013
Economic alliance   health care reform update march 5-2013Economic alliance   health care reform update march 5-2013
Economic alliance health care reform update march 5-2013Michelle Hundley
 
το σχολείο μας η ομάδα μας
το σχολείο μας η ομάδα μαςτο σχολείο μας η ομάδα μας
το σχολείο μας η ομάδα μαςprasino
 
A trek to everest2
A trek to everest2A trek to everest2
A trek to everest2Jayant65i
 
Practical skills in medical practice
Practical skills in medical practicePractical skills in medical practice
Practical skills in medical practiceAvinash Bhondwe
 
Innovaties Fontys KLM minor
Innovaties Fontys KLM minorInnovaties Fontys KLM minor
Innovaties Fontys KLM minorPeter Wessel
 
Changing Digital Behaviour May 2012
Changing Digital Behaviour May 2012Changing Digital Behaviour May 2012
Changing Digital Behaviour May 2012Essential Research
 
V mware vi3_2006
V mware vi3_2006V mware vi3_2006
V mware vi3_2006Vladan Laxa
 

Destaque (17)

Apresentação destinos: Lisboa, Madri, Paris com Fátima, Lourdes e Castelos do...
Apresentação destinos: Lisboa, Madri, Paris com Fátima, Lourdes e Castelos do...Apresentação destinos: Lisboa, Madri, Paris com Fátima, Lourdes e Castelos do...
Apresentação destinos: Lisboa, Madri, Paris com Fátima, Lourdes e Castelos do...
 
Economic alliance health care reform update march 5-2013
Economic alliance   health care reform update march 5-2013Economic alliance   health care reform update march 5-2013
Economic alliance health care reform update march 5-2013
 
Finance1
Finance1Finance1
Finance1
 
pir
pirpir
pir
 
M arco teorico
M arco teoricoM arco teorico
M arco teorico
 
Presentacion
PresentacionPresentacion
Presentacion
 
το σχολείο μας η ομάδα μας
το σχολείο μας η ομάδα μαςτο σχολείο μας η ομάδα μας
το σχολείο μας η ομάδα μας
 
Ad
AdAd
Ad
 
124952960 the-voice-een-aanvullend-verdienmodel
124952960 the-voice-een-aanvullend-verdienmodel124952960 the-voice-een-aanvullend-verdienmodel
124952960 the-voice-een-aanvullend-verdienmodel
 
A trek to everest2
A trek to everest2A trek to everest2
A trek to everest2
 
Malaysia
MalaysiaMalaysia
Malaysia
 
Tumores da bexiga
Tumores da bexigaTumores da bexiga
Tumores da bexiga
 
Practical skills in medical practice
Practical skills in medical practicePractical skills in medical practice
Practical skills in medical practice
 
Innovaties Fontys KLM minor
Innovaties Fontys KLM minorInnovaties Fontys KLM minor
Innovaties Fontys KLM minor
 
CornellX HOSP
CornellX HOSPCornellX HOSP
CornellX HOSP
 
Changing Digital Behaviour May 2012
Changing Digital Behaviour May 2012Changing Digital Behaviour May 2012
Changing Digital Behaviour May 2012
 
V mware vi3_2006
V mware vi3_2006V mware vi3_2006
V mware vi3_2006
 

Semelhante a Pourquoi ruby et rails déchirent

Ruby/Rails
Ruby/RailsRuby/Rails
Ruby/Railsrstankov
 
Introduction to Rails - presented by Arman Ortega
Introduction to Rails - presented by Arman OrtegaIntroduction to Rails - presented by Arman Ortega
Introduction to Rails - presented by Arman Ortegaarman o
 
Ruby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developerRuby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developergicappa
 
Ruby on Rails at PROMPT ISEL '11
Ruby on Rails at PROMPT ISEL '11Ruby on Rails at PROMPT ISEL '11
Ruby on Rails at PROMPT ISEL '11Pedro Cunha
 
Rails 3 (beta) Roundup
Rails 3 (beta) RoundupRails 3 (beta) Roundup
Rails 3 (beta) RoundupWayne Carter
 
Rails for Beginners - Le Wagon
Rails for Beginners - Le WagonRails for Beginners - Le Wagon
Rails for Beginners - Le WagonAlex Benoit
 
Rails2 Pr
Rails2 PrRails2 Pr
Rails2 Prxibbar
 
RoR 101: Session 2
RoR 101: Session 2RoR 101: Session 2
RoR 101: Session 2Rory Gianni
 
Ruby On Rails Introduction
Ruby On Rails IntroductionRuby On Rails Introduction
Ruby On Rails IntroductionThomas Fuchs
 
Pourquoi Ruby on Rails ça déchire ?
Pourquoi Ruby on Rails ça déchire ?Pourquoi Ruby on Rails ça déchire ?
Pourquoi Ruby on Rails ça déchire ?Simon Courtois
 
A tour on ruby and friends
A tour on ruby and friendsA tour on ruby and friends
A tour on ruby and friends旻琦 潘
 
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...Matt Gauger
 
Connecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRubyConnecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRubyNick Sieger
 
Tdc 2013 - Ecossistema Ruby
Tdc 2013 - Ecossistema RubyTdc 2013 - Ecossistema Ruby
Tdc 2013 - Ecossistema RubyFabio Akita
 
Building RESTful APIs w/ Grape
Building RESTful APIs w/ GrapeBuilding RESTful APIs w/ Grape
Building RESTful APIs w/ GrapeDaniel Doubrovkine
 
Getting started with Rails (2), Season 2
Getting started with Rails (2), Season 2Getting started with Rails (2), Season 2
Getting started with Rails (2), Season 2RORLAB
 
Getting Started with Rails
Getting Started with RailsGetting Started with Rails
Getting Started with RailsBasayel Said
 
Rails 3: Dashing to the Finish
Rails 3: Dashing to the FinishRails 3: Dashing to the Finish
Rails 3: Dashing to the FinishYehuda Katz
 

Semelhante a Pourquoi ruby et rails déchirent (20)

Ruby/Rails
Ruby/RailsRuby/Rails
Ruby/Rails
 
Introduction to Rails - presented by Arman Ortega
Introduction to Rails - presented by Arman OrtegaIntroduction to Rails - presented by Arman Ortega
Introduction to Rails - presented by Arman Ortega
 
Ruby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developerRuby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developer
 
Ruby on Rails at PROMPT ISEL '11
Ruby on Rails at PROMPT ISEL '11Ruby on Rails at PROMPT ISEL '11
Ruby on Rails at PROMPT ISEL '11
 
Rails 3 (beta) Roundup
Rails 3 (beta) RoundupRails 3 (beta) Roundup
Rails 3 (beta) Roundup
 
Rails for Beginners - Le Wagon
Rails for Beginners - Le WagonRails for Beginners - Le Wagon
Rails for Beginners - Le Wagon
 
Rails 4.0
Rails 4.0Rails 4.0
Rails 4.0
 
Rails2 Pr
Rails2 PrRails2 Pr
Rails2 Pr
 
RoR 101: Session 2
RoR 101: Session 2RoR 101: Session 2
RoR 101: Session 2
 
Ruby On Rails Introduction
Ruby On Rails IntroductionRuby On Rails Introduction
Ruby On Rails Introduction
 
Pourquoi Ruby on Rails ça déchire ?
Pourquoi Ruby on Rails ça déchire ?Pourquoi Ruby on Rails ça déchire ?
Pourquoi Ruby on Rails ça déchire ?
 
A tour on ruby and friends
A tour on ruby and friendsA tour on ruby and friends
A tour on ruby and friends
 
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...
 
Connecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRubyConnecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRuby
 
Cocoa on-rails-3rd
Cocoa on-rails-3rdCocoa on-rails-3rd
Cocoa on-rails-3rd
 
Tdc 2013 - Ecossistema Ruby
Tdc 2013 - Ecossistema RubyTdc 2013 - Ecossistema Ruby
Tdc 2013 - Ecossistema Ruby
 
Building RESTful APIs w/ Grape
Building RESTful APIs w/ GrapeBuilding RESTful APIs w/ Grape
Building RESTful APIs w/ Grape
 
Getting started with Rails (2), Season 2
Getting started with Rails (2), Season 2Getting started with Rails (2), Season 2
Getting started with Rails (2), Season 2
 
Getting Started with Rails
Getting Started with RailsGetting Started with Rails
Getting Started with Rails
 
Rails 3: Dashing to the Finish
Rails 3: Dashing to the FinishRails 3: Dashing to the Finish
Rails 3: Dashing to the Finish
 

Último

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
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
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
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
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
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
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
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
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
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
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
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
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
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 

Último (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
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
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
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
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
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
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
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
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
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
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
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
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
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

Pourquoi ruby et rails déchirent

  • 1. POURQUOI RUBY ET RAILS DÉCHIRENT ! Par Nicolas Ledez
  • 2.
  • 3. RUBY 1/3 • Interprété • Objet • Multiparadigme • Multiplateforme • Libre, gratuit, etc
  • 4. RUBY 2/3 • Ramasse-miettes • Gestion d'exceptions • Expressions rationnelles (Regexp) • Blocs • Extensions en C
  • 5. RUBY 3/3 • Héritage simple • Mixin -> « héritage multiple » • Réflexion • Crée en 1995
  • 6. VIRTUAL MACHINE • Matz's Ruby Interpreter – Cruby • JRuby • Rubinius • MacRuby • mruby • RubyMotion
  • 8. POUR LES DEV • Rspec, Cucumber, Minitest, ... • HAML, SASS, Compass, ... • Pow, Spork, Guard, ... • Bundler, RVM, Rbenv, Pik, ... • Rails, Sinatra, ... • Vagrant
  • 9. POUR LA PRODUCTION • Unicorn, Passenger, ... • Capistrano, Pupetts, Chef, ... • Graylog2, God, ...
  • 10. POUR LES DEV • Cucumber • Guard, SASS, Compass, ... • Vagrant • Graylog2, God, ...
  • 11. ET ENCORE... •+ de 43 667 gems sur RubyGems.org • ruby-toolbox.com
  • 12. RAILS json Rack Uglifier i18n ERB ActiveRecord
  • 13. MV C
  • 14. M odel View C ontroller
  • 15. OR M
  • 17. ACTIVE RECORD articles id title body 1 hello world This is a body # app/models/article.rb class Article < ActiveRecord::Base end article = Article.first article.title #=> "hello world"
  • 18. ACTIVE RECORD articles id title body published 1 hello world This is a body 1 2 other art. Not published 0 articles = Article.where(published: 1) articles.count #=> 1
  • 21. ACTIVE RECORD articles id title body author_id # app/models/article.rb 1 ... ... 1 class Article < ActiveRec... belongs_to :author end # app/models/author.rb class Author < ActiveRec... authors has_many :articles id name end 1 John Doe article = Article.first article.author.name #=> “John Doe”
  • 22. ACTIVE RECORD MySQL PostgreSQL SQLite ...
  • 23. ROUTING # app/controller/hello_controller.rb class HelloController < ApplicationController def index @name = params[:name] end end http://example.com/hello/John # config/routes.rb get "hello/:name" => "hello#index" action du contrôleur URL contrôleur verbe HTTP paramètre
  • 24. VUES # app/controller/hello_controller.rb class HelloController < ApplicationController def index @name = params[:name] end end # app/views/hello/index.html.erb Bonjour <%= @name %> Conventions !
  • 25. HELPERS # app/controller/articles_controller.rb class ArticlesController < ApplicationController def new @article = Article.new end end Title <%= form_for @article do |f| %> <p><%= f.label :title, "Title" %><br /> <%= f.text_field :title %></p> Body <p><%= f.label :body, "Body" %><br /> <%= f.text_area :body %></p> <p><%= f.submit %></p> <% end %> Create Article
  • 26. RAILTIES $ rake routes GET /hello/:name { :controller => "hello", :action => "index" } $ rails server Lance un serveur web sur http://localhost:3000/ $ rails console Lance une console avec le contexte de l’application >> Article.first.title #=> "hello world"
  • 27. GÉNÉRATEURS $ rails generate model author name:string invoke active_record create db/migrate/20120108151543_create_authors.rb create app/models/author.rb instructions de création de la table authors modèle Author
  • 28. GÉNÉRATEURS $ rails g scaffold author name:string create db/migrate/20120108152723_create_authors.rb create app/models/author.rb modèle route resources :authors routes create app/controllers/authors_controller.rb contrôleur create app/views/authors/index.html.erb create app/views/authors/edit.html.erb create app/views/authors/show.html.erb create app/views/authors/new.html.erb vues create app/views/authors/_form.html.erb create public/stylesheets/scaffold.css CSS par défaut
  • 29. GÉNÉRATEURS # config/routes.rb resources :authors authors GET /authors { action: index controller: authors } author GET /authors/:id { action: show controller: authors } new_author GET /authors/new { action: new controller: authors } POST /authors { action: create controller: authors } edit_author GET /authors/:id/edit { action: edit controller: authors } PUT /authors/:id { action: update controller: authors } DELETE /authors/:id { action: destroy controller: authors } <%= link_to "All authors", authors_path %> <%= link_to "Edit", edit_author_path(@author) %>
  • 38. LES PETITS PLUS D’ACTIVESUPPORT 1.kilobytes! #=> 1024 3.days.ago!! #=> Sat, 04 Feb 2012 17:45:42 CET +01:00 "héhé test".parameterize! #=> "hehe-test" “article”.pluralize! ! ! #=> "articles" !
  • 40. VUES ET FORMULAIRES <%= form_for @article do |f| %> <p><%= f.label :title, "Title" %><br /> <%= f.text_field :title %></p> <p><%= f.label :body, "Body" %><br /> <%= f.text_area :body %></p> <p><%= f.submit %></p> <% end %> slim + simple_form = simple_form_for @article do |f| = f.input :title = f.input :body = f.submit
  • 41. ET TANT D’AUTRES Mongoid Pagination MongoDB Kaminari Carierwave Système d’administration Upload de fichiers Active Admin
  • 42. QUI UTILISE RAILS ? Twitter Github Basecamp Pages Jaunes US Groupon Shopify http://rubyonrails.org/applications
  • 44. JRUBY
  • 46. ESSAYER EN LIGNE • tryruby.org • rubykoans.com • rubymonk.com • railsforzombies.org
  • 47. POUR APPRENDRE • hackety.com • ruby.railstutorial.org • railscasts.com • jasimabasheer.com/posts/ meta_introduction_to_ruby.html • www.pierreschambacher.com/blog/lectures-pour- apprendre-ruby-et-rails/
  • 48. A SUIVRE • nicolas.ledez.net @nledez • organicweb.fr @organicweb • camilleroux.com @CamilleRoux • matthieusegret.com @MatthieuSegret • news.humancoders.com @Human_Coders • @brmichel (http://linuxfr.org/)
  • 49. LA COMMUNAUTÉE • Apéros Ruby • rubyfrance.org • railsfrance.org • Google groups: • Rennes on Rails • Railsfrance
  • 50. UN GRAND MERCI •A Simon Courtois • @happynoff • Pour ses slides : • http://blog.happynoff.fr/post/pourquoi-ruby-on-rails-ca-dechire