SlideShare a Scribd company logo
Ruby on Rails,
Apache httpd, and Oracle
Dan Davis
davisda4@mail.nlm.nih.gov
B1N14Q
Overview
 Why this Talk?
 Ruby on Rails
 Fast prototyping (demo)
 Integrating with Apache httpd
 Integrating with Oracle
 Maybe demo
Why this Talk?
 Node.js, MongoDB, and Express were cool
 Lots of Rapid Prototyping Environments
• Ruby on Rails (Digital Collections)
• ColdFusion (many things)
• php (Cake)
 Secure, Reliable, Transparent Data
 Integration
Why Ruby on Rails?
 How I started: a great application
 MVC
• Rapid prototyping
• Separation of Concerns
• Generators
 Unit and Integration Testing
 Security is built-in
 Community
 Library of “gems”
Ruby Overview
 General Purpose
 Innovative Class and Object model
 Domain Specific Languages
 Lamdas (function objects), Blocks, and Mixins
 JRuby
Class and Object model
•Everything is an Object
•Module – namespace, interface, behavior
•Class – inheritance, instantiation
Ruby - Domain Specific Languages
 Implicit Hash, no parents
doit first, second, :k1 => v1, :k2 => v2
doit first, second, k1: v1, k2: v2
 Comes from Functional Programming
(FORTH, Tcl, Ruby, Python)
 Examples Today
• Gemfile
• Routing
• Rspec Tests (BDD)
Ruby - Lambdas and Blocks
 Lambdas – function objects
l = lambda ( “There is no try” )
Puts l.call
 Blocks – are implicit arguments
def implicit_block(number)
puts yield(number)
end
implicit_block(7) { |number| number + 1 }
 Blocks – sometimes explicit
def explicit_block (number, &block)
Ruby - Mixins
 Can include a module
class AccountController
include AccountHelpers
…
 Can extend a module
bar = Bar.new
bar.extend Foo
 Can re-open objects
class String
def empty?
end
 Changes API Design
Ruby - jruby
 ruby is like perl – C with links to libs
 jruby is JVM implementation
 jruby starts slow, gets fast
 Not quite transparent
• Some “gems” implemented differently
• Some “gems” not available
• Cannot call SWT/Swing from ruby!
• Higher bar to start
Rails - Generators
 Application
rails new demoapp
 Model
rails generate User name:string 
email:string password_hash:string
 Migration
rails g migration AddRoleToUser
 Controller
rails g controller Users all view edit
 Integration Test
rails g integration_test AccountSettings
Ruby - Gemfile
 Tracks dependencies (like Ivy, Maven)
 Example of Domain Specific Language
 Easy
# Use jquery as the JavaScript library
gem 'jquery-rails', '~> 3.1.0'
gem 'jquery-datatables-rails'
Rails - Routing
 config/routes.rb
Nedtable::Application.routes.draw do
get ‘users’, to: ‘users#all’
post ‘users’, to: ‘users#create’
get ‘users/:id’, to: ‘users#view’
get ‘users/:id/edit’, to: ‘users#edit’
post ‘users/:id’, to: ‘users#update’
end
 See it in web
 See it on the console
Rails - rspec
 Behavioral Driven Testing
 Easy to read
describe MarcExporter do
it { should respond_to :to_marc }
it { should respond_to :reader }
…
describe "for NLM UI 1589530" do
…
its(:to_xml) { should == xmldata }
its(:to_marc) { should == mrcdata }
end
 “Mock” network connections
Rails - security
 CSRF
• automatically adds to form
• Automatically checks
 Injection
• You never have to write SQL
• Automatically wraps SQL/XML
 CSS - Safe by default
<%= “<br/>”.html_safe() %>
Rails - So much more
 Asset Pipeline
 Layouts
 Engines
 “gems” and more “gems”
Why Apache2? Why Oracle?
 Good Tools give you:
 Shoulders to stand on (powerful abstractions)
 Without compromising flexibility
 Good Architecture:
 Same thing at Project level
 Good Standards:
 Same thing at Organizational Level
Apache2 - Context
Apache2 – nlm.conf
<Location /solr>
ProxyPass ajp://localhost:8009/solr
ProxyPassReverse ajp://localhost:8009/solr
Options -MultiViews
Order allow,deny
Allow from 130.14.160.225/24
AuthType CAS
AuthName "NLM Login"
CASScope /
Require user davisda4 butlerj pantr
CASAuthNHeader REMOTE_USER
</Location>
Oracle - Benefits
 Reliable
 Secure
 XMLDB is included
 Transparent – SQL Developer/Toad
 Oracle Support in OSS evaluation
• Measures maturity
• Measures Enterprise readiness
Oracle – link to Rails
 Gemfile
gem 'ruby-oci8', '~> 2.1.0'
gem 'activerecord-oracle_enhanced-adapter’
 config/database.yml
development:
adapter: oracle_enhanced
database: 'oltp01_dev'
username: 'discovery'
password: ‘cleartext’
 Integrating getDBPassword
password: <% `getDBPassword …` %>
 Multiple Databases
establish_connection :serials
Let’s Build Something
 ER Diagram
 Navigational State Diagram
Cheat sheet #1
 Create Application
rails new allhands –T
cd allhands
 Update Gemfile and get dependencies
vim Gemfile
bundle update
bundle install
 Integrate dependencies through generators
rails g devise:install
rails g active_admin:install
rake db:migrate
Cheat sheet #2
 Create Models
rails g model Person …
rails g model OrgUnit …
rake db:migrate
rails g active_admin:resource Person
rails g active_admin:resource OrgUnit
 Fix Saving the Data
 Fix “associations”, e.g. foreign keys
 Add graphviz integration
 How much code did I write?
Takeaways - Learning
 Ms. Frizzle
• Make mistakes
• Try things
• Get messy
 Learning is Fun
• Cold Fusion MVC frameworks?
• Call Java libraries from CFML?
• Call jruby libs from CFML?
Questions?

More Related Content

PDF
Avik_RailsTutorial
KEY
An introduction to Rails 3
PPT
Ruby on Rails workshop for beginner
PDF
Security Goodness with Ruby on Rails
PPTX
Laravel introduction
PDF
RESTFul Tools For Lazy Experts - CFSummit 2016
PPTX
Oak, the architecture of Apache Jackrabbit 3
PPTX
Scaling with swagger
Avik_RailsTutorial
An introduction to Rails 3
Ruby on Rails workshop for beginner
Security Goodness with Ruby on Rails
Laravel introduction
RESTFul Tools For Lazy Experts - CFSummit 2016
Oak, the architecture of Apache Jackrabbit 3
Scaling with swagger

What's hot (20)

PDF
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
PDF
Apache Jackrabbit
PPT
Java SE 7 New Features and Enhancements
PDF
Ror Seminar With agilebd.org on 23 Jan09
PPT
Java, Ruby & Rails
PPTX
Scala in the Wild
PPTX
Ruby on rails for beginers
PDF
An Introduction to the Laravel Framework (AFUP Forum PHP 2014)
PPT
Content Storage With Apache Jackrabbit
PPT
Introduction to Ruby on Rails
PDF
Laravel
PDF
Padrino - the Godfather of Sinatra
PPTX
I18nize Scala programs à la gettext
PDF
Skinny Framework Progress Situation
PPTX
Building Micro-Services with Scala
PPTX
Ruby on Rails Penetration Testing
PPT
Sbt, idea and eclipse
PPTX
Laravel Webcon 2015
PDF
Beginning Scala with Skinny Framework #jjug_ccc
PDF
Zeppelin meetup 2016 madrid
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Apache Jackrabbit
Java SE 7 New Features and Enhancements
Ror Seminar With agilebd.org on 23 Jan09
Java, Ruby & Rails
Scala in the Wild
Ruby on rails for beginers
An Introduction to the Laravel Framework (AFUP Forum PHP 2014)
Content Storage With Apache Jackrabbit
Introduction to Ruby on Rails
Laravel
Padrino - the Godfather of Sinatra
I18nize Scala programs à la gettext
Skinny Framework Progress Situation
Building Micro-Services with Scala
Ruby on Rails Penetration Testing
Sbt, idea and eclipse
Laravel Webcon 2015
Beginning Scala with Skinny Framework #jjug_ccc
Zeppelin meetup 2016 madrid
Ad

Viewers also liked (8)

KEY
Essential programmer library
PDF
Ruby on Rails in UbiSunrise
PDF
ODP
Rubynetto
PDF
Introduction to Ruby on Rails
PDF
RoR (Ruby on Rails)
PDF
Ruby on Rails Presentation
PDF
Study: The Future of VR, AR and Self-Driving Cars
Essential programmer library
Ruby on Rails in UbiSunrise
Rubynetto
Introduction to Ruby on Rails
RoR (Ruby on Rails)
Ruby on Rails Presentation
Study: The Future of VR, AR and Self-Driving Cars
Ad

Similar to Ruby on Rails All Hands Meeting (20)

PPT
Ruby on Rails (RoR) as a back-end processor for Apex
PDF
Ruby On Rails Basics
KEY
Why ruby and rails
PDF
Ruby on Rails (RoR) as a back-end processor for Apex
PPT
Ruby On Rails
PPT
Ruby on rails
PPTX
Exploring Ruby on Rails and PostgreSQL
PDF
遇見 Ruby on Rails
PDF
When To Use Ruby On Rails
PPTX
Rubyonrails 120409061835-phpapp02
PDF
Connecting the Worlds of Java and Ruby with JRuby
KEY
Ruby On Rails
KEY
Ruby on Rails survival guide of an aged Java developer
PDF
RubyEnRails2007 - Dr Nic Williams - Keynote
PPTX
Ruby on Rails - An overview
PPT
Ruby On Rails Siddhesh
PDF
rubyonrails
PDF
rubyonrails
PDF
Ruby on Rails : 簡介與入門
PDF
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Ruby on Rails (RoR) as a back-end processor for Apex
Ruby On Rails Basics
Why ruby and rails
Ruby on Rails (RoR) as a back-end processor for Apex
Ruby On Rails
Ruby on rails
Exploring Ruby on Rails and PostgreSQL
遇見 Ruby on Rails
When To Use Ruby On Rails
Rubyonrails 120409061835-phpapp02
Connecting the Worlds of Java and Ruby with JRuby
Ruby On Rails
Ruby on Rails survival guide of an aged Java developer
RubyEnRails2007 - Dr Nic Williams - Keynote
Ruby on Rails - An overview
Ruby On Rails Siddhesh
rubyonrails
rubyonrails
Ruby on Rails : 簡介與入門
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...

Recently uploaded (20)

PDF
Machine learning based COVID-19 study performance prediction
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Empathic Computing: Creating Shared Understanding
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Electronic commerce courselecture one. Pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Review of recent advances in non-invasive hemoglobin estimation
Machine learning based COVID-19 study performance prediction
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
20250228 LYD VKU AI Blended-Learning.pptx
NewMind AI Weekly Chronicles - August'25 Week I
Unlocking AI with Model Context Protocol (MCP)
Per capita expenditure prediction using model stacking based on satellite ima...
Encapsulation_ Review paper, used for researhc scholars
Building Integrated photovoltaic BIPV_UPV.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Agricultural_Statistics_at_a_Glance_2022_0.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Empathic Computing: Creating Shared Understanding
Network Security Unit 5.pdf for BCA BBA.
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
Electronic commerce courselecture one. Pdf
Spectral efficient network and resource selection model in 5G networks
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Review of recent advances in non-invasive hemoglobin estimation

Ruby on Rails All Hands Meeting

  • 1. Ruby on Rails, Apache httpd, and Oracle Dan Davis davisda4@mail.nlm.nih.gov B1N14Q
  • 2. Overview  Why this Talk?  Ruby on Rails  Fast prototyping (demo)  Integrating with Apache httpd  Integrating with Oracle  Maybe demo
  • 3. Why this Talk?  Node.js, MongoDB, and Express were cool  Lots of Rapid Prototyping Environments • Ruby on Rails (Digital Collections) • ColdFusion (many things) • php (Cake)  Secure, Reliable, Transparent Data  Integration
  • 4. Why Ruby on Rails?  How I started: a great application  MVC • Rapid prototyping • Separation of Concerns • Generators  Unit and Integration Testing  Security is built-in  Community  Library of “gems”
  • 5. Ruby Overview  General Purpose  Innovative Class and Object model  Domain Specific Languages  Lamdas (function objects), Blocks, and Mixins  JRuby
  • 6. Class and Object model •Everything is an Object •Module – namespace, interface, behavior •Class – inheritance, instantiation
  • 7. Ruby - Domain Specific Languages  Implicit Hash, no parents doit first, second, :k1 => v1, :k2 => v2 doit first, second, k1: v1, k2: v2  Comes from Functional Programming (FORTH, Tcl, Ruby, Python)  Examples Today • Gemfile • Routing • Rspec Tests (BDD)
  • 8. Ruby - Lambdas and Blocks  Lambdas – function objects l = lambda ( “There is no try” ) Puts l.call  Blocks – are implicit arguments def implicit_block(number) puts yield(number) end implicit_block(7) { |number| number + 1 }  Blocks – sometimes explicit def explicit_block (number, &block)
  • 9. Ruby - Mixins  Can include a module class AccountController include AccountHelpers …  Can extend a module bar = Bar.new bar.extend Foo  Can re-open objects class String def empty? end  Changes API Design
  • 10. Ruby - jruby  ruby is like perl – C with links to libs  jruby is JVM implementation  jruby starts slow, gets fast  Not quite transparent • Some “gems” implemented differently • Some “gems” not available • Cannot call SWT/Swing from ruby! • Higher bar to start
  • 11. Rails - Generators  Application rails new demoapp  Model rails generate User name:string email:string password_hash:string  Migration rails g migration AddRoleToUser  Controller rails g controller Users all view edit  Integration Test rails g integration_test AccountSettings
  • 12. Ruby - Gemfile  Tracks dependencies (like Ivy, Maven)  Example of Domain Specific Language  Easy # Use jquery as the JavaScript library gem 'jquery-rails', '~> 3.1.0' gem 'jquery-datatables-rails'
  • 13. Rails - Routing  config/routes.rb Nedtable::Application.routes.draw do get ‘users’, to: ‘users#all’ post ‘users’, to: ‘users#create’ get ‘users/:id’, to: ‘users#view’ get ‘users/:id/edit’, to: ‘users#edit’ post ‘users/:id’, to: ‘users#update’ end  See it in web  See it on the console
  • 14. Rails - rspec  Behavioral Driven Testing  Easy to read describe MarcExporter do it { should respond_to :to_marc } it { should respond_to :reader } … describe "for NLM UI 1589530" do … its(:to_xml) { should == xmldata } its(:to_marc) { should == mrcdata } end  “Mock” network connections
  • 15. Rails - security  CSRF • automatically adds to form • Automatically checks  Injection • You never have to write SQL • Automatically wraps SQL/XML  CSS - Safe by default <%= “<br/>”.html_safe() %>
  • 16. Rails - So much more  Asset Pipeline  Layouts  Engines  “gems” and more “gems”
  • 17. Why Apache2? Why Oracle?  Good Tools give you:  Shoulders to stand on (powerful abstractions)  Without compromising flexibility  Good Architecture:  Same thing at Project level  Good Standards:  Same thing at Organizational Level
  • 19. Apache2 – nlm.conf <Location /solr> ProxyPass ajp://localhost:8009/solr ProxyPassReverse ajp://localhost:8009/solr Options -MultiViews Order allow,deny Allow from 130.14.160.225/24 AuthType CAS AuthName "NLM Login" CASScope / Require user davisda4 butlerj pantr CASAuthNHeader REMOTE_USER </Location>
  • 20. Oracle - Benefits  Reliable  Secure  XMLDB is included  Transparent – SQL Developer/Toad  Oracle Support in OSS evaluation • Measures maturity • Measures Enterprise readiness
  • 21. Oracle – link to Rails  Gemfile gem 'ruby-oci8', '~> 2.1.0' gem 'activerecord-oracle_enhanced-adapter’  config/database.yml development: adapter: oracle_enhanced database: 'oltp01_dev' username: 'discovery' password: ‘cleartext’  Integrating getDBPassword password: <% `getDBPassword …` %>  Multiple Databases establish_connection :serials
  • 22. Let’s Build Something  ER Diagram  Navigational State Diagram
  • 23. Cheat sheet #1  Create Application rails new allhands –T cd allhands  Update Gemfile and get dependencies vim Gemfile bundle update bundle install  Integrate dependencies through generators rails g devise:install rails g active_admin:install rake db:migrate
  • 24. Cheat sheet #2  Create Models rails g model Person … rails g model OrgUnit … rake db:migrate rails g active_admin:resource Person rails g active_admin:resource OrgUnit  Fix Saving the Data  Fix “associations”, e.g. foreign keys  Add graphviz integration  How much code did I write?
  • 25. Takeaways - Learning  Ms. Frizzle • Make mistakes • Try things • Get messy  Learning is Fun • Cold Fusion MVC frameworks? • Call Java libraries from CFML? • Call jruby libs from CFML?