SlideShare uma empresa Scribd logo
1 de 30
Baixar para ler offline
Introduction to Ruby on Rails

        Agnieszka Figiel
         blog.agnessa.eu



    Kraków Ruby Users Group
         May 19th 2007
Design Principles     MVC architecture   Agile Development   Usability and Success Stories   Community and Resources




Ruby on Rails


       quot;Rails is a full-stack framework for developing
       database-backed web applications according to the
       Model-View-Control pattern.quot;
       www.rubyonrails.org - Ruby on Rails official site

       2005 David Heinemeier Hansson

       opinionated software: quot;it’s a very pragmatic, very targeted
       framework with a strong sense of direction. You might not
       share its vision, but it undeniably has one.quot;
       DHH for Linux Journal (http://www.linuxjournal.com/article/8686)



Introduction to Ruby on Rails
Design Principles     MVC architecture   Agile Development   Usability and Success Stories   Community and Resources




Outline


       Design Principles

       MVC architecture

       Agile Development

       Usability and Success Stories

       Community and Resources




Introduction to Ruby on Rails
Design Principles     MVC architecture   Agile Development   Usability and Success Stories   Community and Resources




       Design Principles

       MVC architecture

       Agile Development

       Usability and Success Stories

       Community and Resources




Introduction to Ruby on Rails
Design Principles     MVC architecture   Agile Development   Usability and Success Stories   Community and Resources




Model - View - Controller

       separate data (model) from user interface (view)

               Model
                        data access and business logic
                        independent of the view and controller
               View
                        data presentation and user interaction
                        read-only access to the model
               Controller
                        handling events
                        operating on model and view



Introduction to Ruby on Rails
Design Principles     MVC architecture   Agile Development   Usability and Success Stories   Community and Resources




Database Persistance



               OR mapping
               Active Record design pattern
               migrations
               incremental schema management
               multiple db adapters
               MySQL, PostgreSQL, SQLite, SQL Server, IBM DB2,
               Informix, Oracle, Firebird/Interbase, LDAP, SybaseASA




Introduction to Ruby on Rails
Design Principles     MVC architecture   Agile Development   Usability and Success Stories   Community and Resources




Full Stack Framework



               MVC suite
               built-in webserver
               default db adapter
               integrated logger
               AJAX, web services, email
               test framework
               plugins




Introduction to Ruby on Rails
Design Principles     MVC architecture   Agile Development   Usability and Success Stories   Community and Resources




Convention over Configuration


               fixed directory structure
               everything has its place – source files, libs, plugins,
               database files, documentation etc
               file naming conventions
               e.g. camel case class name, underscore file name
               database naming conventions
               table names, primary and foreign keys
               standard configuration files
               e.g. database connections, environment setting definitions
               (development, production, test)



Introduction to Ruby on Rails
Design Principles     MVC architecture   Agile Development   Usability and Success Stories   Community and Resources




DRY - Don’t Repeat Yourself


               reusing code
               e.g. view elements
               reusing data
               e.g. no need to declare table field names – can be read
               from the database
               making each line of code work harder
               e.g. mini languages for specific domains, like
               object-relational mapping
               metaprogramming
               dynamically created methods



Introduction to Ruby on Rails
Design Principles     MVC architecture   Agile Development   Usability and Success Stories   Community and Resources




       Design Principles

       MVC architecture

       Agile Development

       Usability and Success Stories

       Community and Resources




Introduction to Ruby on Rails
Design Principles     MVC architecture   Agile Development   Usability and Success Stories   Community and Resources




Model - ActiveRecord

               conventions:
                        name based OR mapping: mice db table -> Mouse class
                        primary key: auto-incremented numeric field called quot;idquot;
                        foreign key: quot;[singular_of_foreign_table_name]_idquot;, e.g.
                        quot;cat_idquot;
               dynamic getters, setters, finders
               dynamic means the existance of a field in db is enough to
               manipulate it, e.g. dynamic getter like: mouse.name
               abstracted db operations - create, update, destroy, find, ...
               possible to use raw sql, but usually unnecessary, e.g.:
               Mouse.find(:all, :include => {:mouse_holes},
               :conditions => quot;location = ’shed’quot;,
               :order => quot;namequot;, :limit => 10)


Introduction to Ruby on Rails
Design Principles     MVC architecture   Agile Development   Usability and Success Stories   Community and Resources




Model - ActiveRecord
               support for basic entity relations (1:1, 1:n, n:n) with
               dynamic accessors
               backyard_mouse_hole.mice #=> Array of Mouse objects
               parametrised queries against SQL injection, e.g. find all
               mice whose name is sth entered by the user:
               Mouse.find(:all, :conditions => [quot;name = ?quot;,
               mouse_name)

               validators: an object won’t be saved in db unless it passes
               all validation rules, e.g. uniqueness of a given field:
               validates_uniqueness_of :login
               object life cycle callbacks, e.g.
               before_create, before_save
               Single Table Inheritance, polymorphic associations
Introduction to Ruby on Rails
Design Principles     MVC architecture   Agile Development   Usability and Success Stories   Community and Resources




View - ActionView


               multiple template types
                        oldest and basic: erb (embedded ruby), similar to e.g. jsp
                        remote javascript templates
                        xml templates
               easy reuse of view elements
                        file inclusion – layouts, templates, partials
                        multiple standard quot;helpersquot; – common html element
                        generators (e.g. form elements, paginators)
               ridiculously easy AJAX integration – prototype,
               scriptaculous



Introduction to Ruby on Rails
Design Principles     MVC architecture   Agile Development   Usability and Success Stories   Community and Resources




Controller - ActionController
               all actions grouped logically in controller objects (actions
               are public methods of the controller class)
               conventions
                        name based url – action mapping
                        e.g. url: myhost.com/mice/show/1
                        action: ’show’ action in MiceController, params: id=1
                        name based action - template file mapping
                        e.g. action ’show’ in MiceController - template file
                        app/views/mice/show.rhtml
               can be organised in an inheritance hierarchy
               reduces code duplication and simplifies code
               action callbacks –
               before_filter, after_filter, around_filter
               built-in mechanism of url rewrites – routes
               easy access to request data, session, cookies
Introduction to Ruby on Rails
Design Principles     MVC architecture   Agile Development   Usability and Success Stories   Community and Resources




       Design Principles

       MVC architecture

       Agile Development

       Usability and Success Stories

       Community and Resources




Introduction to Ruby on Rails
Design Principles     MVC architecture   Agile Development   Usability and Success Stories   Community and Resources




Rapid Development




               built-in webserver
               generators – save the fingers
               scaffold – kick-off start
               plugins, libraries, tons of contributed code




Introduction to Ruby on Rails
Design Principles     MVC architecture   Agile Development   Usability and Success Stories   Community and Resources




Debugging




               verbose log output
               breakpoint debugger
               script/console




Introduction to Ruby on Rails
Design Principles     MVC architecture   Agile Development   Usability and Success Stories   Community and Resources




Testing




               test database + fixtures
               unit tests - tests for models
               functional - tests for controllers
               integration - tests for workflow
               testing directly in browser - Selenium




Introduction to Ruby on Rails
Design Principles     MVC architecture   Agile Development   Usability and Success Stories   Community and Resources




Agile Project Heartbeat




               test coverage - rcov
               continuous integration
               iterative db schema control - migrations
               automated deployment - capistrano




Introduction to Ruby on Rails
Design Principles     MVC architecture   Agile Development   Usability and Success Stories   Community and Resources




       Design Principles

       MVC architecture

       Agile Development

       Usability and Success Stories

       Community and Resources




Introduction to Ruby on Rails
Design Principles     MVC architecture   Agile Development   Usability and Success Stories   Community and Resources




Platform Independence




               win, lin, mac
               Apache, Lighttpd, mongrel
               gem package manager




Introduction to Ruby on Rails
Design Principles     MVC architecture   Agile Development   Usability and Success Stories   Community and Resources




IDEs



               textmate
               vim
               RadRails, Eclipse + RDT, Aptana
               plugins for Idea, NetBeans
               SCiTe
               jEdit




Introduction to Ruby on Rails
Design Principles     MVC architecture   Agile Development   Usability and Success Stories   Community and Resources




Scaling


               it scales – a must-see slideshow about scaling twitter (600
               req/s!): http://www.slideshare.net/Blaine/scaling-twitter
               view caching
                        page caching
                        action caching
                        fragment caching
               sql caching
                        memcached
               shared nothing architecture - multiplying application
               servers



Introduction to Ruby on Rails
Design Principles     MVC architecture   Agile Development   Usability and Success Stories   Community and Resources




Hosting




               http://wiki.rubyonrails.org/rails/pages/RailsWebHosts
               US - a variety of shared hosting offers
               Poland - poor shared hosting options hosted.pl
               Root VPS




Introduction to Ruby on Rails
Design Principles     MVC architecture   Agile Development   Usability and Success Stories   Community and Resources




Success Stories


       several ror powered high traffic sites
               http://twitter.com/ - community site
               http://www.odeo.com/ - music sharing
               http://www.43things.com/, http://www.43places.com/,
               http://www.43people.com/
               37Signals: BaseCamp, BackPack, Ta-Da List, Writeboard,
               CampFire
               http://www.strongspace.com/ - storing and sharing files




Introduction to Ruby on Rails
Design Principles     MVC architecture   Agile Development   Usability and Success Stories   Community and Resources




       Design Principles

       MVC architecture

       Agile Development

       Usability and Success Stories

       Community and Resources




Introduction to Ruby on Rails
Design Principles     MVC architecture   Agile Development   Usability and Success Stories   Community and Resources




Books

               in English:
                        ruby: quot;Programming Ruby 2nd Editionquot; (the Pickaxe) Dave
                        Thomas, with Chad Fowler and Andy Hunt
                        quot;Agile Web Development with Railsquot; Dave Thomas and
                        David Heinemeier Hansson
                        quot;Rails Recipesquot; Chad Fowler
                        many, many more: http://www.rubyonrails.org/books
               in Polish:
                        quot;Programowanie w jezyku Ruby. Wydanie IIquot; Dave Thomas,
                                            ˛
                        Chad Fowler, Andy Hunt
                        quot;Rails. Przepisyquot; Chad Fowler
                        quot;Ruby on Rails. Wprowadzeniequot; Bruce A. Tate, Curt Hibbs
                                         ´
                        quot;Ruby on Rails. Cwiczeniaquot; Michał Sobczak


Introduction to Ruby on Rails
Design Principles     MVC architecture   Agile Development   Usability and Success Stories   Community and Resources




Links


               main site: http://www.rubyonrails.org
               PL site: http://www.rubyonrails.pl/
               general mailing list:
               http://groups.google.com/group/rubyonrails-talk
               wiki: http://wiki.rubyonrails.org/rails
               api: api.rubyonrails.org
               74 Quality Ruby on Rails Resources and Tutorials:
               http://www.softwaredeveloper.com/features/74-ruby-on-
               rails-resources-tutorials-050207/



Introduction to Ruby on Rails
Design Principles     MVC architecture   Agile Development   Usability and Success Stories   Community and Resources




Events



               Rails Conf
               Rails Day
               local communities & meetings
               Ruby on Rails workshops:
               http://rubyonrailsworkshops.com/
               academic presence




Introduction to Ruby on Rails
Questions?




  pics:
  http://www.midcoast.com/ holo/Seth%20in%20Thailand/pages/Rail%20tracks.html,

  http://mfrost.typepad.com/cute_overload/2007/05/this_site_is_dr.html

Mais conteúdo relacionado

Mais procurados

Cooking Perl with Chef: Real World Tutorial with Jitterbug
Cooking Perl with Chef: Real World Tutorial with JitterbugCooking Perl with Chef: Real World Tutorial with Jitterbug
Cooking Perl with Chef: Real World Tutorial with JitterbugDavid Golden
 
Java, Ruby & Rails
Java, Ruby & RailsJava, Ruby & Rails
Java, Ruby & RailsPeter Lind
 
Introduction to Laravel Framework (5.2)
Introduction to Laravel Framework (5.2)Introduction to Laravel Framework (5.2)
Introduction to Laravel Framework (5.2)Viral Solani
 
Buildr In Action @devoxx france 2012
Buildr In Action @devoxx france 2012Buildr In Action @devoxx france 2012
Buildr In Action @devoxx france 2012alexismidon
 
Laravel for Web Artisans
Laravel for Web ArtisansLaravel for Web Artisans
Laravel for Web ArtisansRaf Kewl
 
What's New In Laravel 5
What's New In Laravel 5What's New In Laravel 5
What's New In Laravel 5Darren Craig
 
Ruby On Rails Seminar Basis Softexpo Feb2010
Ruby On Rails Seminar Basis Softexpo Feb2010Ruby On Rails Seminar Basis Softexpo Feb2010
Ruby On Rails Seminar Basis Softexpo Feb2010arif44
 
REST APIs in Laravel 101
REST APIs in Laravel 101REST APIs in Laravel 101
REST APIs in Laravel 101Samantha Geitz
 
Laravel Restful API and AngularJS
Laravel Restful API and AngularJSLaravel Restful API and AngularJS
Laravel Restful API and AngularJSBlake Newman
 
Adventures in Laravel 5 SunshinePHP 2016 Tutorial
Adventures in Laravel 5 SunshinePHP 2016 TutorialAdventures in Laravel 5 SunshinePHP 2016 Tutorial
Adventures in Laravel 5 SunshinePHP 2016 TutorialJoe Ferguson
 
Utiliser Webpack dans une application Symfony
Utiliser Webpack dans une application SymfonyUtiliser Webpack dans une application Symfony
Utiliser Webpack dans une application SymfonyAlain Hippolyte
 
Mobile Open Day: React Native: Crossplatform fast dive
Mobile Open Day: React Native: Crossplatform fast diveMobile Open Day: React Native: Crossplatform fast dive
Mobile Open Day: React Native: Crossplatform fast diveepamspb
 
Laravel introduction
Laravel introductionLaravel introduction
Laravel introductionSimon Funk
 

Mais procurados (20)

Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
 
Java presentation
Java presentationJava presentation
Java presentation
 
Cooking Perl with Chef: Real World Tutorial with Jitterbug
Cooking Perl with Chef: Real World Tutorial with JitterbugCooking Perl with Chef: Real World Tutorial with Jitterbug
Cooking Perl with Chef: Real World Tutorial with Jitterbug
 
Java, Ruby & Rails
Java, Ruby & RailsJava, Ruby & Rails
Java, Ruby & Rails
 
Introduction to Laravel Framework (5.2)
Introduction to Laravel Framework (5.2)Introduction to Laravel Framework (5.2)
Introduction to Laravel Framework (5.2)
 
Laravel 5
Laravel 5Laravel 5
Laravel 5
 
Why Laravel?
Why Laravel?Why Laravel?
Why Laravel?
 
Buildr In Action @devoxx france 2012
Buildr In Action @devoxx france 2012Buildr In Action @devoxx france 2012
Buildr In Action @devoxx france 2012
 
Laravel for Web Artisans
Laravel for Web ArtisansLaravel for Web Artisans
Laravel for Web Artisans
 
What's New In Laravel 5
What's New In Laravel 5What's New In Laravel 5
What's New In Laravel 5
 
Ruby On Rails Seminar Basis Softexpo Feb2010
Ruby On Rails Seminar Basis Softexpo Feb2010Ruby On Rails Seminar Basis Softexpo Feb2010
Ruby On Rails Seminar Basis Softexpo Feb2010
 
Laravel ppt
Laravel pptLaravel ppt
Laravel ppt
 
REST APIs in Laravel 101
REST APIs in Laravel 101REST APIs in Laravel 101
REST APIs in Laravel 101
 
Laravel Restful API and AngularJS
Laravel Restful API and AngularJSLaravel Restful API and AngularJS
Laravel Restful API and AngularJS
 
Java server pages
Java server pagesJava server pages
Java server pages
 
Adventures in Laravel 5 SunshinePHP 2016 Tutorial
Adventures in Laravel 5 SunshinePHP 2016 TutorialAdventures in Laravel 5 SunshinePHP 2016 Tutorial
Adventures in Laravel 5 SunshinePHP 2016 Tutorial
 
Utiliser Webpack dans une application Symfony
Utiliser Webpack dans une application SymfonyUtiliser Webpack dans une application Symfony
Utiliser Webpack dans une application Symfony
 
Mobile Open Day: React Native: Crossplatform fast dive
Mobile Open Day: React Native: Crossplatform fast diveMobile Open Day: React Native: Crossplatform fast dive
Mobile Open Day: React Native: Crossplatform fast dive
 
Laravel introduction
Laravel introductionLaravel introduction
Laravel introduction
 
Ember - introduction
Ember - introductionEmber - introduction
Ember - introduction
 

Destaque

Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on RailsEleni Huebsch
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on RailsAmit Patel
 
ActiveRecord Query Interface (1), Season 1
ActiveRecord Query Interface (1), Season 1ActiveRecord Query Interface (1), Season 1
ActiveRecord Query Interface (1), Season 1RORLAB
 
Make your app idea a reality with Ruby On Rails
Make your app idea a reality with Ruby On RailsMake your app idea a reality with Ruby On Rails
Make your app idea a reality with Ruby On RailsNataly Tkachuk
 
ActiveRecord Validations, Season 2
ActiveRecord Validations, Season 2ActiveRecord Validations, Season 2
ActiveRecord Validations, Season 2RORLAB
 
6 reasons Jubilee could be a Rubyist's new best friend
6 reasons Jubilee could be a Rubyist's new best friend6 reasons Jubilee could be a Rubyist's new best friend
6 reasons Jubilee could be a Rubyist's new best friendForrest Chang
 
ActiveWarehouse/ETL - BI & DW for Ruby/Rails
ActiveWarehouse/ETL - BI & DW for Ruby/RailsActiveWarehouse/ETL - BI & DW for Ruby/Rails
ActiveWarehouse/ETL - BI & DW for Ruby/RailsPaul Gallagher
 
Performance Optimization of Rails Applications
Performance Optimization of Rails ApplicationsPerformance Optimization of Rails Applications
Performance Optimization of Rails ApplicationsSerge Smetana
 
Neev Expertise in Ruby on Rails (RoR)
Neev Expertise in Ruby on Rails (RoR)Neev Expertise in Ruby on Rails (RoR)
Neev Expertise in Ruby on Rails (RoR)Neev Technologies
 
Introduction to Ruby
Introduction to RubyIntroduction to Ruby
Introduction to RubyRanjith Siji
 
From a monolithic Ruby on Rails app to the JVM
From a monolithic  Ruby on Rails app  to the JVMFrom a monolithic  Ruby on Rails app  to the JVM
From a monolithic Ruby on Rails app to the JVMPhil Calçado
 
Ruby On Rails Introduction
Ruby On Rails IntroductionRuby On Rails Introduction
Ruby On Rails IntroductionThomas Fuchs
 
Design in Tech Report 2017
Design in Tech Report 2017Design in Tech Report 2017
Design in Tech Report 2017John Maeda
 

Destaque (16)

Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Rails
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Rails
 
ActiveRecord Query Interface (1), Season 1
ActiveRecord Query Interface (1), Season 1ActiveRecord Query Interface (1), Season 1
ActiveRecord Query Interface (1), Season 1
 
Make your app idea a reality with Ruby On Rails
Make your app idea a reality with Ruby On RailsMake your app idea a reality with Ruby On Rails
Make your app idea a reality with Ruby On Rails
 
ActiveRecord Validations, Season 2
ActiveRecord Validations, Season 2ActiveRecord Validations, Season 2
ActiveRecord Validations, Season 2
 
6 reasons Jubilee could be a Rubyist's new best friend
6 reasons Jubilee could be a Rubyist's new best friend6 reasons Jubilee could be a Rubyist's new best friend
6 reasons Jubilee could be a Rubyist's new best friend
 
Rails Performance
Rails PerformanceRails Performance
Rails Performance
 
ActiveWarehouse/ETL - BI & DW for Ruby/Rails
ActiveWarehouse/ETL - BI & DW for Ruby/RailsActiveWarehouse/ETL - BI & DW for Ruby/Rails
ActiveWarehouse/ETL - BI & DW for Ruby/Rails
 
Performance Optimization of Rails Applications
Performance Optimization of Rails ApplicationsPerformance Optimization of Rails Applications
Performance Optimization of Rails Applications
 
Neev Expertise in Ruby on Rails (RoR)
Neev Expertise in Ruby on Rails (RoR)Neev Expertise in Ruby on Rails (RoR)
Neev Expertise in Ruby on Rails (RoR)
 
Ruby on Rails
Ruby on RailsRuby on Rails
Ruby on Rails
 
Introduction to Ruby
Introduction to RubyIntroduction to Ruby
Introduction to Ruby
 
Ruby Beyond Rails
Ruby Beyond RailsRuby Beyond Rails
Ruby Beyond Rails
 
From a monolithic Ruby on Rails app to the JVM
From a monolithic  Ruby on Rails app  to the JVMFrom a monolithic  Ruby on Rails app  to the JVM
From a monolithic Ruby on Rails app to the JVM
 
Ruby On Rails Introduction
Ruby On Rails IntroductionRuby On Rails Introduction
Ruby On Rails Introduction
 
Design in Tech Report 2017
Design in Tech Report 2017Design in Tech Report 2017
Design in Tech Report 2017
 

Semelhante a Introduction to Ruby on Rails

Server-side Web development via Ruby on Rails
Server-side Web development via Ruby on RailsServer-side Web development via Ruby on Rails
Server-side Web development via Ruby on Railsg3ppy
 
Ruby Rails Web Development
Ruby Rails Web DevelopmentRuby Rails Web Development
Ruby Rails Web DevelopmentSonia Simi
 
Beginners' guide to Ruby on Rails
Beginners' guide to Ruby on RailsBeginners' guide to Ruby on Rails
Beginners' guide to Ruby on RailsVictor Porof
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Railsiradarji
 
Lecture #5 Introduction to rails
Lecture #5 Introduction to railsLecture #5 Introduction to rails
Lecture #5 Introduction to railsEvgeniy Hinyuk
 
Introduction to Rails by Evgeniy Hinyuk
Introduction to Rails by Evgeniy HinyukIntroduction to Rails by Evgeniy Hinyuk
Introduction to Rails by Evgeniy HinyukPivorak MeetUp
 
Introducing Ruby/MVC/RoR
Introducing Ruby/MVC/RoRIntroducing Ruby/MVC/RoR
Introducing Ruby/MVC/RoRSumanth krishna
 
MVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on RailsMVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on Railscodeinmotion
 
ruby on rails development company in india
ruby on rails development company in indiaruby on rails development company in india
ruby on rails development company in indiaSAG IPL
 
What is ASP.NET MVC
What is ASP.NET MVCWhat is ASP.NET MVC
What is ASP.NET MVCBrad Oyler
 
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...Nilesh Panchal
 
Ruby On Rails Basics
Ruby On Rails BasicsRuby On Rails Basics
Ruby On Rails BasicsAmit Solanki
 
Ruby on Rails: Building Web Applications Is Fun Again!
Ruby on Rails: Building Web Applications Is Fun Again!Ruby on Rails: Building Web Applications Is Fun Again!
Ruby on Rails: Building Web Applications Is Fun Again!judofyr
 
Ruby On Rails - Rochester K Linux User Group
Ruby On Rails - Rochester K Linux User GroupRuby On Rails - Rochester K Linux User Group
Ruby On Rails - Rochester K Linux User GroupJose de Leon
 

Semelhante a Introduction to Ruby on Rails (20)

Server-side Web development via Ruby on Rails
Server-side Web development via Ruby on RailsServer-side Web development via Ruby on Rails
Server-side Web development via Ruby on Rails
 
Ruby Rails Web Development
Ruby Rails Web DevelopmentRuby Rails Web Development
Ruby Rails Web Development
 
Beginners' guide to Ruby on Rails
Beginners' guide to Ruby on RailsBeginners' guide to Ruby on Rails
Beginners' guide to Ruby on Rails
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
 
Lecture #5 Introduction to rails
Lecture #5 Introduction to railsLecture #5 Introduction to rails
Lecture #5 Introduction to rails
 
Introduction to Rails by Evgeniy Hinyuk
Introduction to Rails by Evgeniy HinyukIntroduction to Rails by Evgeniy Hinyuk
Introduction to Rails by Evgeniy Hinyuk
 
Ruby on rails for beginers
Ruby on rails for beginersRuby on rails for beginers
Ruby on rails for beginers
 
Introducing Ruby/MVC/RoR
Introducing Ruby/MVC/RoRIntroducing Ruby/MVC/RoR
Introducing Ruby/MVC/RoR
 
MVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on RailsMVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on Rails
 
ruby on rails development company in india
ruby on rails development company in indiaruby on rails development company in india
ruby on rails development company in india
 
What is ASP.NET MVC
What is ASP.NET MVCWhat is ASP.NET MVC
What is ASP.NET MVC
 
Ruby on rails
Ruby on railsRuby on rails
Ruby on rails
 
Ruby on Rails
Ruby on Rails Ruby on Rails
Ruby on Rails
 
Ruby on rails
Ruby on railsRuby on rails
Ruby on rails
 
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
 
Aspose pdf
Aspose pdfAspose pdf
Aspose pdf
 
Ruby On Rails Basics
Ruby On Rails BasicsRuby On Rails Basics
Ruby On Rails Basics
 
Ruby on Rails: Building Web Applications Is Fun Again!
Ruby on Rails: Building Web Applications Is Fun Again!Ruby on Rails: Building Web Applications Is Fun Again!
Ruby on Rails: Building Web Applications Is Fun Again!
 
Ruby On Rails - Rochester K Linux User Group
Ruby On Rails - Rochester K Linux User GroupRuby On Rails - Rochester K Linux User Group
Ruby On Rails - Rochester K Linux User Group
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
 

Último

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
 
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
 
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
 
[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
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
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
 
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
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
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
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
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
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
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
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
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
 

Último (20)

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...
 
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
 
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...
 
[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
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
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
 
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
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
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
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
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
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
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
 

Introduction to Ruby on Rails

  • 1. Introduction to Ruby on Rails Agnieszka Figiel blog.agnessa.eu Kraków Ruby Users Group May 19th 2007
  • 2. Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources Ruby on Rails quot;Rails is a full-stack framework for developing database-backed web applications according to the Model-View-Control pattern.quot; www.rubyonrails.org - Ruby on Rails official site 2005 David Heinemeier Hansson opinionated software: quot;it’s a very pragmatic, very targeted framework with a strong sense of direction. You might not share its vision, but it undeniably has one.quot; DHH for Linux Journal (http://www.linuxjournal.com/article/8686) Introduction to Ruby on Rails
  • 3. Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources Outline Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources Introduction to Ruby on Rails
  • 4. Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources Introduction to Ruby on Rails
  • 5. Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources Model - View - Controller separate data (model) from user interface (view) Model data access and business logic independent of the view and controller View data presentation and user interaction read-only access to the model Controller handling events operating on model and view Introduction to Ruby on Rails
  • 6. Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources Database Persistance OR mapping Active Record design pattern migrations incremental schema management multiple db adapters MySQL, PostgreSQL, SQLite, SQL Server, IBM DB2, Informix, Oracle, Firebird/Interbase, LDAP, SybaseASA Introduction to Ruby on Rails
  • 7. Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources Full Stack Framework MVC suite built-in webserver default db adapter integrated logger AJAX, web services, email test framework plugins Introduction to Ruby on Rails
  • 8. Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources Convention over Configuration fixed directory structure everything has its place – source files, libs, plugins, database files, documentation etc file naming conventions e.g. camel case class name, underscore file name database naming conventions table names, primary and foreign keys standard configuration files e.g. database connections, environment setting definitions (development, production, test) Introduction to Ruby on Rails
  • 9. Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources DRY - Don’t Repeat Yourself reusing code e.g. view elements reusing data e.g. no need to declare table field names – can be read from the database making each line of code work harder e.g. mini languages for specific domains, like object-relational mapping metaprogramming dynamically created methods Introduction to Ruby on Rails
  • 10. Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources Introduction to Ruby on Rails
  • 11. Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources Model - ActiveRecord conventions: name based OR mapping: mice db table -> Mouse class primary key: auto-incremented numeric field called quot;idquot; foreign key: quot;[singular_of_foreign_table_name]_idquot;, e.g. quot;cat_idquot; dynamic getters, setters, finders dynamic means the existance of a field in db is enough to manipulate it, e.g. dynamic getter like: mouse.name abstracted db operations - create, update, destroy, find, ... possible to use raw sql, but usually unnecessary, e.g.: Mouse.find(:all, :include => {:mouse_holes}, :conditions => quot;location = ’shed’quot;, :order => quot;namequot;, :limit => 10) Introduction to Ruby on Rails
  • 12. Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources Model - ActiveRecord support for basic entity relations (1:1, 1:n, n:n) with dynamic accessors backyard_mouse_hole.mice #=> Array of Mouse objects parametrised queries against SQL injection, e.g. find all mice whose name is sth entered by the user: Mouse.find(:all, :conditions => [quot;name = ?quot;, mouse_name) validators: an object won’t be saved in db unless it passes all validation rules, e.g. uniqueness of a given field: validates_uniqueness_of :login object life cycle callbacks, e.g. before_create, before_save Single Table Inheritance, polymorphic associations Introduction to Ruby on Rails
  • 13. Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources View - ActionView multiple template types oldest and basic: erb (embedded ruby), similar to e.g. jsp remote javascript templates xml templates easy reuse of view elements file inclusion – layouts, templates, partials multiple standard quot;helpersquot; – common html element generators (e.g. form elements, paginators) ridiculously easy AJAX integration – prototype, scriptaculous Introduction to Ruby on Rails
  • 14. Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources Controller - ActionController all actions grouped logically in controller objects (actions are public methods of the controller class) conventions name based url – action mapping e.g. url: myhost.com/mice/show/1 action: ’show’ action in MiceController, params: id=1 name based action - template file mapping e.g. action ’show’ in MiceController - template file app/views/mice/show.rhtml can be organised in an inheritance hierarchy reduces code duplication and simplifies code action callbacks – before_filter, after_filter, around_filter built-in mechanism of url rewrites – routes easy access to request data, session, cookies Introduction to Ruby on Rails
  • 15. Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources Introduction to Ruby on Rails
  • 16. Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources Rapid Development built-in webserver generators – save the fingers scaffold – kick-off start plugins, libraries, tons of contributed code Introduction to Ruby on Rails
  • 17. Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources Debugging verbose log output breakpoint debugger script/console Introduction to Ruby on Rails
  • 18. Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources Testing test database + fixtures unit tests - tests for models functional - tests for controllers integration - tests for workflow testing directly in browser - Selenium Introduction to Ruby on Rails
  • 19. Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources Agile Project Heartbeat test coverage - rcov continuous integration iterative db schema control - migrations automated deployment - capistrano Introduction to Ruby on Rails
  • 20. Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources Introduction to Ruby on Rails
  • 21. Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources Platform Independence win, lin, mac Apache, Lighttpd, mongrel gem package manager Introduction to Ruby on Rails
  • 22. Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources IDEs textmate vim RadRails, Eclipse + RDT, Aptana plugins for Idea, NetBeans SCiTe jEdit Introduction to Ruby on Rails
  • 23. Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources Scaling it scales – a must-see slideshow about scaling twitter (600 req/s!): http://www.slideshare.net/Blaine/scaling-twitter view caching page caching action caching fragment caching sql caching memcached shared nothing architecture - multiplying application servers Introduction to Ruby on Rails
  • 24. Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources Hosting http://wiki.rubyonrails.org/rails/pages/RailsWebHosts US - a variety of shared hosting offers Poland - poor shared hosting options hosted.pl Root VPS Introduction to Ruby on Rails
  • 25. Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources Success Stories several ror powered high traffic sites http://twitter.com/ - community site http://www.odeo.com/ - music sharing http://www.43things.com/, http://www.43places.com/, http://www.43people.com/ 37Signals: BaseCamp, BackPack, Ta-Da List, Writeboard, CampFire http://www.strongspace.com/ - storing and sharing files Introduction to Ruby on Rails
  • 26. Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources Introduction to Ruby on Rails
  • 27. Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources Books in English: ruby: quot;Programming Ruby 2nd Editionquot; (the Pickaxe) Dave Thomas, with Chad Fowler and Andy Hunt quot;Agile Web Development with Railsquot; Dave Thomas and David Heinemeier Hansson quot;Rails Recipesquot; Chad Fowler many, many more: http://www.rubyonrails.org/books in Polish: quot;Programowanie w jezyku Ruby. Wydanie IIquot; Dave Thomas, ˛ Chad Fowler, Andy Hunt quot;Rails. Przepisyquot; Chad Fowler quot;Ruby on Rails. Wprowadzeniequot; Bruce A. Tate, Curt Hibbs ´ quot;Ruby on Rails. Cwiczeniaquot; Michał Sobczak Introduction to Ruby on Rails
  • 28. Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources Links main site: http://www.rubyonrails.org PL site: http://www.rubyonrails.pl/ general mailing list: http://groups.google.com/group/rubyonrails-talk wiki: http://wiki.rubyonrails.org/rails api: api.rubyonrails.org 74 Quality Ruby on Rails Resources and Tutorials: http://www.softwaredeveloper.com/features/74-ruby-on- rails-resources-tutorials-050207/ Introduction to Ruby on Rails
  • 29. Design Principles MVC architecture Agile Development Usability and Success Stories Community and Resources Events Rails Conf Rails Day local communities & meetings Ruby on Rails workshops: http://rubyonrailsworkshops.com/ academic presence Introduction to Ruby on Rails
  • 30. Questions? pics: http://www.midcoast.com/ holo/Seth%20in%20Thailand/pages/Rail%20tracks.html, http://mfrost.typepad.com/cute_overload/2007/05/this_site_is_dr.html