Ruby on Rails on Oracle 2009.5.20 Hoon Lee Department of Logistics Information Technology.

Slides:



Advertisements
Similar presentations
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 15 Introduction to Rails.
Advertisements

More about Ruby Maciej Mensfeld Presented by: Maciej Mensfeld More about Ruby dev.mensfeld.pl github.com/mensfeld.
The Librarian Web Page Carol Wolf CS396X. Create new controller  To create a new controller that can manage more than just books, type ruby script/generate.
Chapter 15 © 2010 by Addison Wesley Longman, Inc Origins and Uses of Ruby - Designed by Yukihiro Matsumoto; released in Use spread rapidly.
Creating Web Services with Ruby on Rails Robert Thew Internet and Web Systems II.
Ruby on Rails. What's Ruby  A programming language  Developed by Yukihiro Matsumoto (aka Matz) in the 1990s  A programming language  Developed by.
Creating Web Services with Ruby on Rails Robert Thew Internet and Web Systems II.
CS 683 Emerging Technologies Fall Semester, 2005 Doc 21 Rails Intro Nov 10, 2005 Copyright ©, All rights reserved SDSU & Roger Whitney, 5500 Campanile.
A complete ror application. Some easy tutorials This uses oracle but it is easy to replace that with mysql:
Ruby on Rails CSE 190M, Spring 2009 Week 5. Installing Rails First, install Ruby with RubyGems Then, install the Rails gem gem install rails -version=2.3.2.
Ruby on Rails Creating a Rails Application Carol E Wolf CS396X.
Intro to Rails INFO 2310: Topics in Web Design and Programming.
Ruby on Rails (Slides modified by ements-2ed.shtml)
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
Ruby on Rails: An Introduction JA-SIG Summer Conference 2007 Michael Irion The University of Tulsa.
PHP Programming. Topics Background and History of PHP Installation Comments in PHP Variables Conditions Loops Functions File Handling Database Handling.
| Lugano, Ruby on Rails.
Ruby (on Rails) CSE 190M, Spring 2009 Week 1. The Players Kelly "Everyday I'm Hustlin' " Dunn Kim "Mouse" Todd Ryan "Papa T" Tucker.
Microsoft Windows 2003 Server. Client/Server Environment Many client computers connect to a server.
Ruby on Rails CSCI 6314 David Gaspar Jennifer Garcia Avila.
SJSU CS157B Dr. Lee1  2004 Jenny Mitchell Two Useful Tools You Can’t Live Without by Jenny Mitchell SJSU CS157B Section PHP and MySQL.
The Ruby Programming Language
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
1 Dr Alexiei Dingli Web Science Stream Models, Views and Controllers.
UC Berkeley Hello Rails. Review: MVC Goal: separate organization of data (model) from UI & presentation (view) by introducing controller –mediates user.
Web Application Programming Carol Wolf Computer Science.
Introduction to Python
Basic Programming in Ruby Today’s Topics: Introduction last class irb history log Methods Classes (briefly) Using 3 rd Party Libraries rubygems ‘ require.
LiveCycle Data Services Introduction Part 2. Part 2? This is the second in our series on LiveCycle Data Services. If you missed our first presentation,
Ruby! Ronald L. Ramos. What is Ruby? Ruby is a scripting language designed by Yukihiro Matsumoto, also known as Matz. It runs on a variety of platforms,
Ruby on Rails Your first app. Rails files app/ Contains the controllers, models, views and assets for your application. You’ll focus on this folder for.
(Chapter 10 continued) Our examples feature MySQL as the database engine. It's open source and free. It's fully featured. And it's platform independent.
Lecture 11 Rails Topics SaaSSaaS Readings: SaaS book Ch February CSCE 740 Software Engineering.
Ruby on Rails CSE 190M, Spring 2009 Week 6. Overview How to use a database Demo creating a blog application on Rails Explain how the application works.
Ruby on Rails. What is Ruby? Programming Language Object-oriented Interpreted.
Database control Introduction. The Database control is a tool that used by the database administrator to control the database. To enter to Database control.
The Active Record Paradigm Databases in Database-Centric Web Site Development.
Associations INFO 2310: Topics in Web Design and Programming.
Ruby on Rails WTF? Created by Matz in 1993 Inspired by Smalltalk Rubygems = CSPAN Rake = ant Rdoc = javadoc.
An Introduction to Designing and Executing Workflows with Taverna Aleksandra Pawlik materials by: Katy Wolstencroft University of Manchester.
Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Perl Specialist.
_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition1  Wiley and the.
CHAPTER 9 PHP AND MYSQL. A POSSIBLE SITE CONFIGURATION Application Folder index.php includes (folder)header.phpfooter.phpstyle.cssmodel (folder)mysqli_connect.php.
CSE 154 LECTURE 5: INTRO TO PHP. URLs and web servers usually when you type a URL in your browser: your computer looks up the.
Rails & Ajax Module 5. Introduction to Rails Overview of Rails Rails is Ruby based “A development framework for Web-based applications” Rails uses the.
Copyright © 2003 ProsoftTraining. All rights reserved. Perl Fundamentals.
Creating a simple database This shows you how to set up a database using PHPMyAdmin (installed with WAMP)
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
Introduction to Ruby&Rails Yuri Veremeyenko Monica Verma.
1 Getting Started with Ruby. 2 What’s Ruby? Ruby is an OO, dynamic, agile language –Everything’s an object For example, try puts -1.abs –Derives strengths.
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 2: Introduction to IS2803 Rob Gleasure
8 th Semester, Batch 2009 Department Of Computer Science SSUET.
CS 160 and CMPE/SE 131 Software Engineering February 9 Class Meeting Department of Computer Science Department of Computer Engineering San José State University.
PHP Form Processing * referenced from
MIS Week 4 Site:
Term Project Rental Shop Hoon Lee Department of Logistics Information Technology.
Ruby on Rails. Web Framework for Ruby Designed to make it easier to develop, deploy, and maintain web applications Design with Model-View-Controller –almost.
PHP Tutorial. What is PHP PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
Presented By P.SRIVIDYA 085D1A0552 Programming Language.
JRuby on Rails Presenter Name
JRuby on Rails Brian Leonard ブライアン レオナルド
Intro to Ethical Hacking
Ruby Getting started & Ruby.New Presented by Mario Tayah
Data Virtualization Demoette… ADO.NET Client
Ruby Tooling in NetBeans
Intro to PHP & Variables
Principles of report writing
Ruby Testing 2, 11/9/2004.
Chapter 15 Introduction to Rails.
Presentation transcript:

Ruby on Rails on Oracle Hoon Lee Department of Logistics Information Technology

목차 0.Overview 1.Oracle 11g Oracle.com, Installation, Registration, … 2.Ruby in Twenty Minutes IRB, Module, Method, String, Class, … 3.Ruby on Rails rubyonrails.org, Download, Installation, … 4.Ruby on Rails on Oracle Setup, Install, Create, Edit, Browser, … 5.Another way using Oracle Create, Edit, Script, Browser, … 6.Reference 2

0. Overview  Who made it?, What does it? –Ruby has made by Yukihiro Matsumoto on –Ruby is object oriented script language. (ex: Perl, Python, PHP) –Rails has made by David Heinemeier Hansson in 37signals. –Rails has been developed to Web Application Development Framework by using Ruby language. 3 Yukihiro MatsumotoDavid Heinemeier Hansson

1. Oracle 11g  Oracle.com 4

1. Oracle 11g  Installation Mode/Type 5 Click to next...

1. Oracle 11g  Pre-conditions 6 Click to next...

1. Oracle 11g  Registration of Oracle Configuration Manager 7 Click to next...

1. Oracle 11g  Summary for Installation 8 Click to next...

1. Oracle 11g  Installation 9

1. Oracle 11g  Setup of Configuration 10

1. Oracle 11g  Result of Configuration 11 Click to next...

1. Oracle 11g  Password Management 12

1. Oracle 11g  End of Installation 13 Click to next...

1. Oracle 11g  Installed Programs and Environment 14

1. Oracle 11g  Database Control 15

1. Oracle 11g  Database Control – Instance Information 16

1. Oracle 11g  SQL Plus – DBA_USERS 17

1. Oracle 11g  Database Control – Unlock SCOTT 18

1. Oracle 11g  Database Control – No/Yes? 19

1. Oracle 11g  SQL Plus – Connection to SCOTT 20 Before the change on Oracle Control After the change on Oracle Control SQL> update dba_users set lock_date = NULL where username = ‘SCOTT’;

1. Oracle 11g  SQL Plus – Connection to SCOTT 21

1. Oracle 11g  Environment for RoR – tnsname.ora, listener.ora 22 LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = )(PORT = 1521)) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = )(PORT = 1521)) ) listener.ora tnsname.ora Sample programs use a tnsname(RAILS) in Ruby on Rails.

1. Oracle 11g  Tip - “Microsoft LoopBack Adapter” –IP: > tnsname.ora -> listener.ora 23 Oracle 11g doesn’t support localhost( )

1. Oracle 11g  Tip – OracleDBConsoleorcl –Start Type: Manual 24 Oracle 11g has a bug with OracleDBConsoleorcl

2. Ruby in Twenty Minutes  25

2. Ruby in Twenty Minutes  26

2. Ruby in Twenty Minutes 27  lang.org/en/documentation/quickstart/

2. Ruby in Twenty Minutes  Interactive Ruby –IRB: stands for Interactive Ruby 28 irb(main):001:0> "Hello World" => "Hello World" irb(main):002:0>

2. Ruby in Twenty Minutes  Ruby Obeyed You! –to print out “Hello World” –puts is the basic command to print something –puts always returns nil(absolutely-positively-nothing value)  Your Free Calculator is Here –Basic calculate, Math objects 29 irb(main):002:0> puts "Hello World" Hello World => nil irb(main):003:0> irb(main):003:0> 3+2 => 5 irb(main):004:0> 3*2 => 6 irb(main):005:0> 3**2 => 9 irb(main):006:0> Math.sqrt(9) => 3.0 irb(main):007:0>

2. Ruby in Twenty Minutes –Modules, Group Code by Topic –Modules serve two roles in Ruby. –One role = grouping similar methods together under a familiar name –Method with a parameter  Definition of the method nil tells us that it knows we’re done defining the method 30 irb(main):007:0> a = 3 ** 2 => 9 irb(main):008:0> b = 4 ** 2 => 16 irb(main):009:0> Math.sqrt(a+b) => 5.0 irb(main):010:0> irb(main):010:0> def h irb(main):011:1> puts "Hello World!" irb(main):012:1> end => nil irb(main):013:0>

2. Ruby in Twenty Minutes  The Brief, Repetitive Lives of a Method –Calling a method If method doesn’t take parameters, empty parentheses aren't needed –Method with parameter The braces(“#{name}”) is turned into a string 31 irb(main):013:0> h Hello World! => nil irb(main):014:0> h() Hello World! => nil irb(main):015:0> irb(main):015:0> def h(name) irb(main):016:1> puts "Hello #{name}!" irb(main):017:1> end => nil irb(main):018:0> h("Matz") Hello Matz! => nil irb(main):019:0>

2. Ruby in Twenty Minutes  Holding Spots in a String –Method with default parameter The parentheses are optional on #023 The braces(“#{name}”) is capitalized properly 32 irb(main):019:0> def h(name = "World") irb(main):020:1> puts "Hello #{name.capitalize}!" irb(main):021:1> end => nil irb(main):022:0> h "chris" Hello Chris! => nil irb(main):023:0> h Hello World! => nil

2. Ruby in Twenty Minutes  Evolving Into a Greeter –“Greeter” class with is an instance variable, is a available to all the methods in the class 33 irb(main):024:0> class Greeter irb(main):025:1> def initialize(name = "World") = name irb(main):027:2> end irb(main):028:1> def say_hi irb(main):029:2> puts "Hi irb(main):030:2> end irb(main):031:1> def say_bye irb(main):032:2> puts "Bye come back soon." irb(main):033:2> end irb(main):034:1> end => nil

2. Ruby in Twenty Minutes Create a greeter object g. it’s name is with “Pat”. If we want to get at the name directly? Can’t do it. Instance variables are hidden away inside the object. 34 irb(main):035:0> g = Greeter.new("Pat") => # irb(main):036:0> g.say_hi Hi Pat !=> nil irb(main):037:0> g.say_bye Bye Pat, come back soon. => nil rb(main):038:0> SyntaxError: compile error (irb):52: syntax error, unexpected tIVAR ^ from (irb):52

2. Ruby in Twenty Minutes  Under the Object’s Skin –The hidden methods exist in Greeter objects? this is all of the methods for Greeter objects, including ones defined by ancestor classes. to not include ancestors by passing it the parameter false 35 irb(main):039:0> Greeter.instance_methods => ["inspect", "clone", "to_yaml", "public_methods", "display", "instance_variab le_defined?", "equal?", "freeze", "methods", "respond_to?", "dup", "instance_var iables", "__id__", "method", "eql?", "h", "id", "to_yaml_properties", "singleton _methods", "taguri", "send", "taint", "frozen?", "taguri=", "instance_variable_g et", "say_hi", "__send__", "instance_of?", "to_a", "type", "to_yaml_style", "pro tected_methods", "object_id", "instance_eval", "==", "===", "instance_variable_s et", "say_bye", "kind_of?", "extend", "to_s", "hash", "class", "tainted?", "=~", "private_methods", "nil?", "untaint", "is_a?"] irb(main):040:0> Greeter.instance_methods(false) => ["say_bye", "say_hi"]

2. Ruby in Twenty Minutes Which methods our greeter object responds to? “to_s” is used to convert something to a string.  Altering Classes - It’s Never Too Late –Access to an object’s variables The changes will be present in any new objects. 36 irb(main):041:0> g.respond_to?("name") => false irb(main):042:0> g.respond_to?("say_hi") => true irb(main):043:0> g.respond_to?("to_s") => true irb(main):044:0> class Greeter irb(main):045:1> attr_accessor :name irb(main):046:1> end => nil

2. Ruby in Twenty Minutes Using attr_accessor defined two new methods, name to get the value, and name= to set it. 37 irb(main):047:0> g = Greeter.new("Andy") => # irb(main):048:0> g.respond_to?("name") => true irb(main):049:0> g.respond_to?("name=") => true irb(main):050:0> g.say_hi Hi Andy! => nil irb(main):051:0> g.name="Betty" => "Betty" irb(main):052:0> g => # irb(main):053:0> g.name => "Betty" irb(main):054:0> g.say_hi Hi Betty! => nil

2. Ruby in Twenty Minutes  Greeting Anything and Everything, MegaGreeter Neglects None! –Create a file, and run it. To quit IRB, type “quit”, “exit” or just hit Control-D 38 #!/usr/bin/env rubyclass MegaGreeter attr_accessor :names # Create the object def initialize(names = = names end # Say hi to everybody def say_hi puts "..." is a list of some kind, do |name| puts "Hello #{name}!" end else puts "Hello end ri20min.rb

2. Ruby in Twenty Minutes 39 # Say bye to everybody def say_bye puts "..." # Join the list elements with commas puts "Goodbye ")}. Come back soon!" else puts "Goodbye Come back soon!" end if __FILE__ == $0 mg = MegaGreeter.new mg.say_hi mg.say_bye # Change name to be "Zeke" mg.names = "Zeke" mg.say_hi mg.say_bye # Change the name to an array of names mg.names = ["Albert", "Brenda", "Charles", "Dave", "Englebert"] mg.say_hi mg.say_bye # Change to nil mg.names = nil mg.say_hi mg.say_bye end ri20min.rb

2. Ruby in Twenty Minutes Save this file as “ri20min.rb”, and run it as “ruby ri20min.rb” Sharp mark(#) is a comment line, but first line of the file tells how to run the file.  Cycling and Looping - a.k.a. Iteration The variable between pipe characters is the parameter for this 40 Hello World! Goodbye World. Come back soon! Hello Zeke! Goodbye Zeke. Come back soon! Hello Albert! Hello Brenda! Hello Charles! Hello Dave! Hello Englebert! Goodbye Albert, Brenda, Charles, Dave, Englebert. Comeback soon!... ruby do |name| puts "Hello #{name}!“ end

2. Ruby in Twenty Minutes  Blocks, the Highly Sparkling Glint on the Edge of Ruby –The real power of block Elements are joined/sequenced by parameter. Prints out like string.  Kicking Off the Script __FILE__ contains the name of current file. $0 is the name of the file used to start the program This check says “If this is the main file being used…” This allows a file to be used as a library, and not to execute code in that context, but if the file is being used as an executable, then execute that code 41 # Join the list elements with commas puts "Goodbye ")}. Come back soon!" if __FILE__ == $0

2. Ruby in Twenty Minutes  Ruby From Other Languages 42

3. Ruby on Rails  43

3. Ruby on Rails  Smart people saying nice things –“Rails is the most well thought-out web development framework I’ve ever used. And that’s in a decade of doing web applications for a living. I’ve built my own frameworks, helped develop the Servlet API, and have created more than a few web servers from scratch. Nobody has done it like this before.” - James Duncan Davidson, Creator of Tomcat and Ant – –“Ruby on Rails is a breakthrough in lowering the barriers of entry to programming. Powerful web applications that formerly might have taken weeks or months to develop can be produced in a matter of days.” - Tim O'Reilly, Founder of O'Reilly Media - 44

3. Ruby on Rails –“It is impossible not to notice Ruby on Rails. It has had a huge effect both in and outside the Ruby community... Rails has become a standard to which even well-established tools are comparing themselves to.” - Martin Fowler, Author of Refactoring, PoEAA, XP Explained – –“What sets this framework apart from all of the others is the preference for convention over configuration making applications easier to develop and understand.” - Sam Ruby, ASF board of directors - –“Rails is the killer app for Ruby.” - Yukihiro Matsumoto, Creator of Ruby - 45

3. Ruby on Rails  Who is already on Rails? 46

3. Ruby on Rails  Download software 47

3. Ruby on Rails  RubyGems 48

3. Ruby on Rails  49

3. Ruby on Rails  Installation of RubyGems & Rails 50

3. Ruby on Rails  Install a Rails –Run “gem install rails” 51 Ref) C:\Ruby\lib\ruby\gems\1.8\cache/doc/gems/specifications if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q, [">= 0.8.3"]) s.add_runtime_dependency(%q, ["= 2.3.2"]) if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q, [">= 0.8.3"]) s.add_runtime_dependency(%q, ["= 2.3.2"]) rails gemspec

3. Ruby on Rails  Make a Web Application 52

3. Ruby on Rails  Make a New Project –Run “rails path/to/your/new/application” 53

3. Ruby on Rails 54  Run a Web Server –Move “cd path/to/your/new/application” –Run “ruby script/server” #!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/server' #!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/server' server

3. Ruby on Rails  55

4. Ruby on Rails on Oracle 56  el-oracle-ruby.html

4. Ruby on Rails on Oracle  Step 1: Set up the Oracle database –Refer to the “1. Oracle 11g” –Create a user on SQL Plus – ruby/ruby  Step 2: Install Ruby, RubyGems, Rails, and the Ruby/Rails Oracle library –Refer to the “3. Ruby on Rails” Use the "One-Click Ruby Installer for Windows Final Release“ Follow the installation instructions 57 SQL> GRANT CONNECT, RESOURCE TO ruby IDENTIFIED BY ruby; SQL> ALTER USER ruby DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp; SQL> EXIT

4. Ruby on Rails on Oracle –Update RubyGems to latest version 58 C:\Ruby>gem update --system Updating RubyGems Updating rubygems-update Successfully installed rubygems-update :0:Warning: Gem::SourceIndex#search support for String patterns is deprecated Updating RubyGems to Installing RubyGems Installing RubyGems Installing gem executable Removing old source_cache files Removing old RubyGems RDoc and ri Installing rubygems ri into C:/Ruby/lib/ruby/gems/1.8/doc/rubygems-1.3.3/r i Installing rubygems rdoc into C:/Ruby/lib/ruby/gems/1.8/doc/rubygems /rdoc = Announce: RubyGems Release …

4. Ruby on Rails on Oracle –Install Rails –Install Ruby Oracle library(Ruby-oci8) –Install ActiveRecord Oracle enhanced adapter 59 C:\Ruby>gem install rails -v Successfully installed rails gem installed Installing ri documentation for rails Installing RDoc documentation for rails C:\Ruby>gem install ruby-oci8 -v Successfully installed ruby-oci x86-mswin32 1 gem installed Installing ri documentation for ruby-oci x86-mswin32... Installing RDoc documentation for ruby-oci x86-mswin32... C:\Ruby>gem install activerecord-oracle-adapter --source Successfully installed activerecord-oracle-adapter gem installed Installing ri documentation for activerecord-oracle-adapter Installing RDoc documentation for activerecord-oracle-adapter

4. Ruby on Rails on Oracle  Step 3: Create the Web Application –Create a new project using the rails command line application 60 C:\Ruby\temp>rails comics_catalog -d oracle create create app/controllers create app/helpers create app/models create app/views/layouts create config/environments create config/initializers create config/locales create db create doc create lib create lib/tasks create log create public/images create public/javascripts create public/stylesheets create script/performance create test/fixtures create test/functional create test/integration create test/performance create test/unit create vendor create vendor/plugins create tmp/sessions create tmp/sockets create tmp/cache create tmp/pids create Rakefile create README create app/controllers/application_controller.rb create app/helpers/application_helper.rb create config/database.yml create config/routes.rb create config/locales/en.yml create config/initializers/backtrace_silencers.rb create config/initializers/inflections.rb create config/initializers/mime_types.rb create config/initializers/new_rails_defaults.rb create config/initializers/session_store.rb create config/environment.rb create config/boot.rb create config/environments/production.rb create config/environments/development.rb create config/environments/test.rb create script/about create script/console create script/dbconsole create script/destroy create script/generate create script/runner create script/server create script/plugin create script/performance/benchmarker create script/performance/profiler create test/test_helper.rb create test/performance/browsing_test.rb create public/404.html create public/422.html create public/500.html create public/index.html create public/favicon.ico create public/robots.txt create public/images/rails.png create public/javascripts/prototype.js create public/javascripts/effects.js create public/javascripts/dragdrop.js create public/javascripts/controls.js create public/javascripts/application.js create doc/README_FOR_APP create log/server.log create log/production.log create log/development.log create log/test.log

4. Ruby on Rails on Oracle –Edit database.yml using Oracle database 61 If you use ActiveRecord Oracle enhanced adapter, specify 'oracle_enhanced' instead of 'oracle' as the adapter

4. Ruby on Rails on Oracle  Create a Web application using the Rails scaffold 62 C:\Ruby\temp\comics_catalog>ruby script/generate scaffold comic title:string issue:integer publisher:string exists app/models/ exists app/controllers/ exists app/helpers/ create app/views/comics exists app/views/layouts/ exists test/functional/ exists test/unit/ create test/unit/helpers/ exists public/stylesheets/ create app/views/comics/index.html.erb create app/views/comics/show.html.erb create app/views/comics/new.html.erb create app/views/comics/edit.html.erb create app/views/layouts/comics.html.erb create public/stylesheets/scaffold.css create app/controllers/comics_controller.rb create test/functional/comics_controller_test.rb create app/helpers/comics_helper.rb create test/unit/helpers/comics_helper_test.rb route map.resources :comics dependency model exists app/models/ exists test/unit/ exists test/fixtures/ create app/models/comic.rb create test/unit/comic_test.rb create test/fixtures/comics.yml create db/migrate create db/migrate/ _create_comics.rb  "title:string issue:integer publisher:string" represents a table column  Rails code generator created model, view, and controller Ruby code to access the COMICS table  If you make any changes to the database tables, you'll need to run the scaffold command again.

4. Ruby on Rails on Oracle –Create a database –Start a Web Server 63 C:\Ruby\temp\comics_catalog>rake db:migrate (in C:/Ruby/temp/comics_catalog) == CreateComics: migrating =================================================== -- create_table(:comics) -> s -> 0 rows == CreateComics: migrated (0.1100s) ========================================== C:\Ruby\temp\comics_catalog>ruby script/server => Booting WEBrick => Rails application starting on => Call with -d to detach => Ctrl-C to shutdown server [ :53:22] INFO WEBrick [ :53:22] INFO ruby ( ) [i386-mswin32] [ :53:22] INFO WEBrick::HTTPServer#start: pid=7376 port=3000  can change the Ruby code at anytime without restarting  if we change the database configuration file, need to restart the server

4. Ruby on Rails on Oracle  Web Browser - List 64

4. Ruby on Rails on Oracle  Web Browser – Create a new record 65

4. Ruby on Rails on Oracle  Web Browser - List 66

4. Ruby on Rails on Oracle  Web Browser – Edit a record 67

4. Ruby on Rails on Oracle  68 To get a Ruby Oracle Library

4. Ruby on Rails on Oracle 69  To get a ActiveRecord Oracle Adapter

4. Ruby on Rails on Oracle  Files and Directories –\comics_catalog\app models\comic.rb views\comics or layouts\*.erb controllers\*.rb helper\*.rb –\comics_catalog\config\database.yml –\comics_catalog\db\schema.rb –… 70  Make API DOC – “C:\comics_catalog>rake doc:app”

5. Another way using Oracle  SQL Plus – Create a user(RAIL) 71

5. Another way using Oracle 72  Edit – Make a comics.sql to create table(s) and record(s)

5. Another way using Oracle  SQL Plus – Run a script file 73

5. Another way using Oracle  Create a New Project(comics_catalog)  Move to directory(comics_catalog)  Edit a database.yml in config directory –development: adapter: oci username: ruby password: ruby host: RAILS  Create a Web application using the Rails scaffold –  Start a Web Server –  Check by Web Browser – 74 C:\> rails comics_catalog C:\> cd comics_catalog C:\comics_catalog> ruby script/generate scaffold Comic C:\comics_catalog> ruby script/server

6. Reference  Ruby Programming Language –  Ruby on Rails –  RubyForge – Project Library –  Ruby Central –  Ruby on Rails on Oracle: A Simple Tutorial – ruby.html  Oracle Database Software Downloads – dex.html 75

Thank You!