Ruby on Rails All Hands Meeting
Upcoming SlideShare
Loading in...5
×
 

Ruby on Rails All Hands Meeting

on

  • 59 views

Presentation on Ruby on Rails at a ColdFusion Oracle shop.

Presentation on Ruby on Rails at a ColdFusion Oracle shop.

Statistics

Views

Total Views
59
Slideshare-icon Views on SlideShare
45
Embed Views
14

Actions

Likes
0
Downloads
0
Comments
0

1 Embed 14

http://192.168.6.184 14

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

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
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Ruby on Rails All Hands Meeting Ruby on Rails All Hands Meeting Presentation Transcript

    • 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?