SlideShare a Scribd company logo
Ruby on Rails Building Web Applications Is Fun Again!
What is Ruby on Rails? Web application framework written in Ruby Ruby is an Object Oriented scripting language Model-view-controller Database agnostic Open source Lots of nice tools, classes and methods to make development easier
The Rails Way DRY (Don’t Repeat Yourself) Convention over configuration Baked in testing Minimal code with maximum effect
Installing Ruby, Gem and Rails Install Ruby OCI8 Driver Connect using TNSNAMES.ORA Connect using InstantClient and a URL More information on wiki.rubyonrails.com Getting Started
Rails on Oracle Key generation assumes sequences for each table with the name ${table_name}_seq Sequence name can be changed using ActiveRecord::Base.set_sequence_name Timezones and sub-second precision not supported More info:  http://wiki.rubyonrails.com/rails/pages/Oracle
Building Your First App Create a new Rails app by typing: rails myapp Edit the config/database.yml Generate a model using: script/generate model MyModel Creating a model creates a class and a migration
ActiveRecord Conventions Naming convention simplifies development and encourages good database design Tables are plural, models are singular Example: Model: LineItem Table: line_items Handles non-regular pluralization such as Person/people Can be overridden, although this complicates things for the developer
Database Migrations Database agnostic means of defining schema Lowest-common-denominator approach Ruby code with full access to ActiveRecord Methods for creating, altering and dropping tables, columns and indexes Can execute arbitrary SQL with ‘execute’ method
ActiveRecord Models Object/Relational Mapping Model classes extend from ActiveRecord::Base ActiveRecord::Base provides: Database agnostic record creation, finding, saving and removal Data validation methods Relationships All in an easy to use package Rails encourages keeping business logic in the model where it belongs AR can be used outside of web applications
Views Responsible for creating part or all of the page displayed in a browser By default uses ERb (Embedded Ruby) Other views include ‘builders’ for XML documents or RJS templates to generate JavaScript for AJAX driven views Includes elegant means for including helper functions for rendering Supports partials and components
Controllers Generate controllers with script/generate controller MyController Controllers tie the view to the model through actions Controllers also have access to “helpers” Designed for people-friendly URLs Provides caching, session management, query parsing, cookie management, pagination
ActiveRecord Relationships  Relationships are through primary keys Supported relationship types: belongs_to (book belongs to author) has_one (book has one publisher) has_many (book has many pages) has_and_belongs_to_many (book has and belongs to many readers) has_many :through (book has many contributors through contributions)
ActiveRecord Validation validates_presence_of validates_uniqueness_of validates_confirmation_of validates_acceptance_of validates_associated validates_each validates_format_of, _length_of validates_exclusion_of, _inclusion_of
More ActiveRecord Acts As acts_as_list (position) acts_as_tree (parent_id) Aggregations composed_of Callbacks Full lifecycle Before and after validation, creation, saving, destroying Calculations average, count, maximum, minimum, sum
Just When You Thought You Had Enough ActiveRecord Callback objects Observers Façade columns Object-level transaction management Magic column names created_on, created_at, updated_on, updated_at auto timestamping and dating lock_version and optimistic locking type for single table inheritence xxx_count counter cache
Other Stuff ActionMailer for sending mail messages ActionView helpers Form helpers Asset tags Javascript support (yummy AJAX!) Pagination Text helpers ActionWebService Ruby language extensions Breakpoint and debugging
Where To Go Next? http://www.rubyonrails.com / http://api.rubyonrails.com / http://wiki.rubyonrails.com/ Agile Web Development with Rails http://www.ruby-doc.org/  for Ruby Programming Ruby IRC, Mailing Lists, Seth Ladd’s brain

More Related Content

PDF
WebNet Conference 2012 - Designing complex applications using html5 and knock...
PDF
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
PPTX
Codemotion 2013 - Designing complex applications using html5 and knockoutjs
PPTX
Single Page Applications on JavaScript and ASP.NET MVC4
PDF
Modern Architectures with Spring and JavaScript
PDF
[2015/2016] Backbone JS
PDF
tTecniche di sviluppo mobile per share point 2013 e office 365
PPTX
Introduction to Client Side Dev in SharePoint Workshop
WebNet Conference 2012 - Designing complex applications using html5 and knock...
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
Codemotion 2013 - Designing complex applications using html5 and knockoutjs
Single Page Applications on JavaScript and ASP.NET MVC4
Modern Architectures with Spring and JavaScript
[2015/2016] Backbone JS
tTecniche di sviluppo mobile per share point 2013 e office 365
Introduction to Client Side Dev in SharePoint Workshop

What's hot (19)

PDF
JAX 2012: Moderne Architektur mit Spring und JavaScript
PPTX
SharePoint Saturday St. Louis - SharePoint & jQuery
PDF
HTML CSS JavaScript jQuery Training
PDF
HTML5: the new frontier of the web
PPTX
Programming is Fun with ASP.NET MVC
PPTX
2/15/2012 - Wrapping Your Head Around the SharePoint Beast
PDF
Berlin.JAR: Web future without web frameworks
PPTX
Industrial training seminar ppt on asp.net
PPTX
SPTechCon - Share point and jquery essentials
PPTX
Transform SharePoint default list forms with HTML, CSS and JavaScript
PPTX
HTL(Sightly) - All you need to know
PPTX
Angular jS Introduction by Google
 
PPT
06 Javascript
PDF
[2015/2016] JavaScript
PDF
Modern development paradigms
PPTX
SPSDenver - SharePoint & jQuery - What I wish I would have known
PDF
SOFEA: Service Oriented Front End Architecture, Next Gen Web Architecture for...
PPT
SD Forum Java SIG - Service Oriented UI Architecture
PPTX
Cartegraph Live HTML, CSS, JavaScript and jQuery Training
JAX 2012: Moderne Architektur mit Spring und JavaScript
SharePoint Saturday St. Louis - SharePoint & jQuery
HTML CSS JavaScript jQuery Training
HTML5: the new frontier of the web
Programming is Fun with ASP.NET MVC
2/15/2012 - Wrapping Your Head Around the SharePoint Beast
Berlin.JAR: Web future without web frameworks
Industrial training seminar ppt on asp.net
SPTechCon - Share point and jquery essentials
Transform SharePoint default list forms with HTML, CSS and JavaScript
HTL(Sightly) - All you need to know
Angular jS Introduction by Google
 
06 Javascript
[2015/2016] JavaScript
Modern development paradigms
SPSDenver - SharePoint & jQuery - What I wish I would have known
SOFEA: Service Oriented Front End Architecture, Next Gen Web Architecture for...
SD Forum Java SIG - Service Oriented UI Architecture
Cartegraph Live HTML, CSS, JavaScript and jQuery Training
Ad

Viewers also liked (20)

PDF
Arr johnstone-vivaldi-double cello-concerto-soloist_parts
ODP
Presentacio dimarts
DOC
Zaid Detail CV
PPTX
PPT
ODP
Assignment 14 representation
PPT
PPT
13 Phrases
PPT
Zoekt en gij zult vinden!
ODP
Assignment 14 representation
PDF
Canon in-d
DOCX
PPT
Meet the Players
PPT
fall 2006 site conditions surveys lecture
PPTX
Rosa Galicia - Economia, objeto y metodo
PPTX
Yaraikellyn peraza
PPTX
Newsletter
PPTX
Vanessa jimenez
PDF
Arr johnstone-vivaldi-double cello-concerto-soloist_parts
Presentacio dimarts
Zaid Detail CV
Assignment 14 representation
13 Phrases
Zoekt en gij zult vinden!
Assignment 14 representation
Canon in-d
Meet the Players
fall 2006 site conditions surveys lecture
Rosa Galicia - Economia, objeto y metodo
Yaraikellyn peraza
Newsletter
Vanessa jimenez
Ad

Similar to Ruby on Rails: Building Web Applications Is Fun Again! (20)

PPT
Ruby On Rails
PPTX
Ruby on rails for beginers
PDF
td_mxc_rubyrails_shin
PDF
td_mxc_rubyrails_shin
DOC
Rails interview questions
PPT
Introduction To Ruby On Rails
PPT
Ruby on rails
PDF
Ruby On Rails
PDF
Lecture #5 Introduction to rails
PDF
Introduction to Rails by Evgeniy Hinyuk
PPTX
12 Introduction to Rails
PPT
Ruby On Rails
PPT
Ruby On Rails Siddhesh
PDF
Ruby on Rails Presentation
PPT
Rail3 intro 29th_sep_surendran
PDF
Introduction to Ruby on Rails
PPT
Ruby On Rails Seminar Basis Softexpo Feb2010
DOCX
Rails Concept
PDF
Ruby Rails Web Development
PDF
Why Use Rails by Dr Nic
Ruby On Rails
Ruby on rails for beginers
td_mxc_rubyrails_shin
td_mxc_rubyrails_shin
Rails interview questions
Introduction To Ruby On Rails
Ruby on rails
Ruby On Rails
Lecture #5 Introduction to rails
Introduction to Rails by Evgeniy Hinyuk
12 Introduction to Rails
Ruby On Rails
Ruby On Rails Siddhesh
Ruby on Rails Presentation
Rail3 intro 29th_sep_surendran
Introduction to Ruby on Rails
Ruby On Rails Seminar Basis Softexpo Feb2010
Rails Concept
Ruby Rails Web Development
Why Use Rails by Dr Nic

Recently uploaded (20)

PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Electronic commerce courselecture one. Pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
A Presentation on Artificial Intelligence
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Big Data Technologies - Introduction.pptx
PDF
Encapsulation theory and applications.pdf
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPT
Teaching material agriculture food technology
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Electronic commerce courselecture one. Pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
A Presentation on Artificial Intelligence
Reach Out and Touch Someone: Haptics and Empathic Computing
CIFDAQ's Market Insight: SEC Turns Pro Crypto
The Rise and Fall of 3GPP – Time for a Sabbatical?
Big Data Technologies - Introduction.pptx
Encapsulation theory and applications.pdf
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Teaching material agriculture food technology
Diabetes mellitus diagnosis method based random forest with bat algorithm
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
20250228 LYD VKU AI Blended-Learning.pptx
Network Security Unit 5.pdf for BCA BBA.
Mobile App Security Testing_ A Comprehensive Guide.pdf

Ruby on Rails: Building Web Applications Is Fun Again!

  • 1. Ruby on Rails Building Web Applications Is Fun Again!
  • 2. What is Ruby on Rails? Web application framework written in Ruby Ruby is an Object Oriented scripting language Model-view-controller Database agnostic Open source Lots of nice tools, classes and methods to make development easier
  • 3. The Rails Way DRY (Don’t Repeat Yourself) Convention over configuration Baked in testing Minimal code with maximum effect
  • 4. Installing Ruby, Gem and Rails Install Ruby OCI8 Driver Connect using TNSNAMES.ORA Connect using InstantClient and a URL More information on wiki.rubyonrails.com Getting Started
  • 5. Rails on Oracle Key generation assumes sequences for each table with the name ${table_name}_seq Sequence name can be changed using ActiveRecord::Base.set_sequence_name Timezones and sub-second precision not supported More info: http://wiki.rubyonrails.com/rails/pages/Oracle
  • 6. Building Your First App Create a new Rails app by typing: rails myapp Edit the config/database.yml Generate a model using: script/generate model MyModel Creating a model creates a class and a migration
  • 7. ActiveRecord Conventions Naming convention simplifies development and encourages good database design Tables are plural, models are singular Example: Model: LineItem Table: line_items Handles non-regular pluralization such as Person/people Can be overridden, although this complicates things for the developer
  • 8. Database Migrations Database agnostic means of defining schema Lowest-common-denominator approach Ruby code with full access to ActiveRecord Methods for creating, altering and dropping tables, columns and indexes Can execute arbitrary SQL with ‘execute’ method
  • 9. ActiveRecord Models Object/Relational Mapping Model classes extend from ActiveRecord::Base ActiveRecord::Base provides: Database agnostic record creation, finding, saving and removal Data validation methods Relationships All in an easy to use package Rails encourages keeping business logic in the model where it belongs AR can be used outside of web applications
  • 10. Views Responsible for creating part or all of the page displayed in a browser By default uses ERb (Embedded Ruby) Other views include ‘builders’ for XML documents or RJS templates to generate JavaScript for AJAX driven views Includes elegant means for including helper functions for rendering Supports partials and components
  • 11. Controllers Generate controllers with script/generate controller MyController Controllers tie the view to the model through actions Controllers also have access to “helpers” Designed for people-friendly URLs Provides caching, session management, query parsing, cookie management, pagination
  • 12. ActiveRecord Relationships Relationships are through primary keys Supported relationship types: belongs_to (book belongs to author) has_one (book has one publisher) has_many (book has many pages) has_and_belongs_to_many (book has and belongs to many readers) has_many :through (book has many contributors through contributions)
  • 13. ActiveRecord Validation validates_presence_of validates_uniqueness_of validates_confirmation_of validates_acceptance_of validates_associated validates_each validates_format_of, _length_of validates_exclusion_of, _inclusion_of
  • 14. More ActiveRecord Acts As acts_as_list (position) acts_as_tree (parent_id) Aggregations composed_of Callbacks Full lifecycle Before and after validation, creation, saving, destroying Calculations average, count, maximum, minimum, sum
  • 15. Just When You Thought You Had Enough ActiveRecord Callback objects Observers Façade columns Object-level transaction management Magic column names created_on, created_at, updated_on, updated_at auto timestamping and dating lock_version and optimistic locking type for single table inheritence xxx_count counter cache
  • 16. Other Stuff ActionMailer for sending mail messages ActionView helpers Form helpers Asset tags Javascript support (yummy AJAX!) Pagination Text helpers ActionWebService Ruby language extensions Breakpoint and debugging
  • 17. Where To Go Next? http://www.rubyonrails.com / http://api.rubyonrails.com / http://wiki.rubyonrails.com/ Agile Web Development with Rails http://www.ruby-doc.org/ for Ruby Programming Ruby IRC, Mailing Lists, Seth Ladd’s brain