• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Introduction to Ruby on Rails
 

Introduction to Ruby on Rails

on

  • 16,045 views

An introduction to the RoR framework prepared for the Kraków Ruby Users Group (http://www.ruby.org.pl)

An introduction to the RoR framework prepared for the Kraków Ruby Users Group (http://www.ruby.org.pl)

Statistics

Views

Total Views
16,045
Views on SlideShare
15,976
Embed Views
69

Actions

Likes
28
Downloads
764
Comments
4

5 Embeds 69

http://www.slideshare.net 31
http://www.istudyiwin.com 28
http://www.techgig.com 5
http://www.linkedin.com 4
http://webcache.googleusercontent.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

14 of 4 previous next Post a comment

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • Slides
    Are you sure you want to
    Your message goes here
    Processing…
  • Impressive presentation of 'Introduction to Ruby on Rails'. You've shown your credibility on presentation with this slideshow. This one deserves thumbs up. I'm John, owner of www.freeringtones.ws/ . Hope to see more quality slides from you.

    Best wishes.
    Are you sure you want to
    Your message goes here
    Processing…
  • Outstanding presentation. Really clear along with helpful
    Anisa
    http://financejedi.com http://healthjedi.com
    Are you sure you want to
    Your message goes here
    Processing…
  • Nice introduction, indeed
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Introduction to Ruby on Rails Introduction to Ruby on Rails Presentation Transcript

    • 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