A complete ror application. Some easy tutorials This uses oracle but it is easy to replace that with mysql:

Slides:



Advertisements
Similar presentations
PHP SQL. Connection code:- mysql_connect("server", "username", "password"); Connect to the Database Server with the authorised user and password. Eg $connect.
Advertisements

Chapter 15 © 2010 by Addison Wesley Longman, Inc Origins and Uses of Ruby - Designed by Yukihiro Matsumoto; released in Use spread rapidly.
Trestle Generator Industrial-strength scaffolding for Ruby on Rails web application development.
Creating Web Services with Ruby on Rails Robert Thew Internet and Web Systems II.
Creating rails app. p:\InstantRails\rails_apps>rails -d mysql cars create create app/controllers create app/helpers create app/models create app/views/layouts.
What is MySQL? MySQL is a relational database management system (A relational database stores data in separate tables rather than putting all the data.
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.
Ruby on rails This ppt contains a pot pourri of information including some sql, some php, some instant rails and so on.
Methods for Rails. File Structures This is taken directly from app Holds all the code that's specific.
27-Jun-15 Rails. What is Rails? Rails is a framework for building web applications This involves: Getting information from the user (client), using HTML.
Creating a wiki blog. Run apps that come with instant rails distribution select I /rails applications/open ruby console window Cd to cookbook or typo.
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.
What is Dropbox ?– Dropbox is a file storage site which gives you an easy way to save your documents, files, and presentations online and access them from.
Irma & Robert. Irma & Robert  Ruby on Rails is an open source web application framework for the Ruby programming language. It is often referred to as.
Intro to Rails INFO 2310: Topics in Web Design and Programming.
Ruby on Rails (Slides modified by ements-2ed.shtml)
SYST Web Technologies SYST Web Technologies Installing a Web Server (XAMPP)
Ruby on Rails: An Introduction JA-SIG Summer Conference 2007 Michael Irion The University of Tulsa.
RUBY ON RAILS It’s so rad. What we’ll cover  What is Ruby?  What is RoR?  Why RoR?  Developing with RoR  Deployment  Demo  Questions.
Rails and Grails. To get started Make sure you have java installed You can get the sdk and jre at:
Deploying Ruby on Rails How to make your application actually serve Dan Buettner 18 Oct 2007.
1 Working with MS SQL Server. 2 Objectives You will be able to Use Visual Studio for GUI based interactive access to a Microsoft SQL Server database.
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.
Session 5: Working with MySQL iNET Academy Open Source Web Development.
SQL HW1 Turn in as a hardcopy at the start of next class period. You may work this assignment in groups.
Guidelines for Homework 6. Getting Started Homework 6 requires that you complete Homework 5. –All of HW5 must run on the GridFarm. –HW6 may run elsewhere.
1 Dr Alexiei Dingli Web Science Stream Introducing Rails.
ATG Environment Setup In this session you will learn – Setting Up ATG environment – Creating new ATG application – Configuring Data Source – Configuring.
1 Working with MS SQL Server Textbook Chapter 14.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Working with MSSQL Server Code:G0-C# Version: 1.0 Author: Pham Trung Hai CTD.
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.
Installing and Using MySQL and phpMyAdmin. Last Time... Installing Apache server Installing PHP Running basic PHP scripts on the server Not necessary.
SYST Web Technologies SYST Web Technologies Databases & MySQL.
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.
The Active Record Paradigm Databases in Database-Centric Web Site Development.
Ruby on Rails (Slides modified by ements-2ed.shtml)
Associations INFO 2310: Topics in Web Design and Programming.
Ruby on Rails on Oracle Hoon Lee Department of Logistics Information Technology.
Photo Gallery INFO 2310: Topics in Web Design and Programming.
Ruby on Rails: Databases. Rails Database Familiar Table Concept Naming convention – lower case, plural (i.e. tweets) How to Access (find), Update, Delete.
1 Dr Alexiei Dingli Web Science Stream A ROR Twitter.
JDBC Tutorial CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
Testing Carol Wolf Computer Science. Testing built into Rails  Rails comes with three databases.  development  test  production  The test database.
Installing MySQL BCIS 3680 Enterprise Programming.
Creating a simple database This shows you how to set up a database using PHPMyAdmin (installed with WAMP)
Studio Fx on Rails Demonstrating the Studio Fx API.
MySQL Getting Started BCIS 3680 Enterprise Programming.
Ruby on Rails+MySQL. Sebesta corvette example In rails_apps create a directory (car_app), change to this dir and run rails (rails cars) Rails_apps Car_app.
WAMP Server Installatin Shiyun Wen. WAMP Server Installation  WAMP Server is an integrated installation of Apache, MySQL, and PHP for Windows. Following.
1 Dr Alexiei Dingli Web Science Stream Installing ROR.
Steps to Install VirtueMart 1. Setup Database 2. Download VirtueMart 3. Setup VirtueMart 4. Test installation Prerequisites: 1. XAMPP installation complete.
MySQL MySQL and PHP – interacting with a database.
Intro to APACHE, MySQL, and PHP & freely available (hackable) Packages Aonghus Sugrue 04 Oct 2012.
1 Rails for the Ruby-Impaired John Paul Ashenfelter CTO/Transitionpoint.
MySQL Getting Started BCIS 3680 Enterprise Programming.
Your current Moodle 1.9 Minimum Requirements Ability to do a TEST RUN! Upgrading Moodle to Version 2 By Ramzan Jabbar Doncaster College for the Deaf By.
Installing a Moodle Test Site The painless and easy way.
16 Copyright © 2004, Oracle. All rights reserved. Testing the Migrated Oracle Database.
9 Copyright © 2004, Oracle. All rights reserved. Getting Started with Oracle Migration Workbench.
1 Adding a Model. We have created an MVC web app project Added a controller class. Added a view class. Next we will add some classes for managing movies.
JRuby on Rails Presenter Name
Migrating Wordpress Migrating Wordpress can sometimes get more complicated as it should. There is no plugin that does this for you, the best way is to.
Working of Script integrated with SiteScope
Bruce Scharlau, University of Aberdeen, 2017
Presentation transcript:

A complete ror application

Some easy tutorials This uses oracle but it is easy to replace that with mysql: oracle-ruby.html oracle-ruby.html There are many rails tutorials online… This one builds the cookbook part 1… and you actually write some code: Books/ONLamp.com%20- %20Rolling%20with%20Ruby%20on%20Rails%20- %20Part%201%20(January%202005).pdf And this is part two of the cookbook:

Create comics app Use I/…/ to open ruby console window. Fromrails apps run: C:\InstantRails\rails_apps>rails comics_catalog create create app/controllers create app/helpers create app/models create app/views/layouts create config/environments create config/initializers create db create doc create lib create lib/tasks create log create public/images create public/javascripts create public/stylesheets create script/performance create script/process …MANY MORE 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 C:\InstantRails\rails_apps> Then change to comics_catalog: C:\InstantRails\rails_apps>cd comics_catalog C:\InstantRails\rails_apps\comics_catalog>

Problems with Sql lite???? My brandnew version of instantrails (4/09) seems to not have sqllite but it seemed to want it. You can get sqllite at This site describes installation for sqllite in ruby/rails: sqlite3-for-ruby-on-rails-development/ sqlite3-for-ruby-on-rails-development/ He says to copy sqllite.exe into ruby/bin, and to run the gem command below. I got an error missing a dll which I downloaded from files.com/dllindex/pop.php?sqlite3http:// files.com/dllindex/pop.php?sqlite3 Not sure if you’ll need it.. Then you need to add it to your path settings, which you are not likely to be able to do!!! Then you still need to install the associated gem: On command line in ruby/bin: –gem install sqlite3-ruby

Contents of comics_catalog and config dir within comics

Databases This app will use a database to hold comics data. Actually, separate dbs for development, testing and productions are often used. You can create these using phpmyadmin or from within the rails environment by running a rails command: rake The next slide shows how to create databases needed for testing, production and development. Save the contents in appdir/config/database.yml There will be a defaulted database.yml in there already. If you have mysqllite then your file will look like the following slide.

Create config/database.yml development: adapter: mysql database: comics_catalog_development username: root password: host:localhost # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: adapter: mysql database: comics_catalog_test username: root password: host:localhost production: adapter: mysql database: comics_catalog_production username:root password: host:localhost

Sqllite database.yml development: adapter: sqlite3 database: db/development.sqlite3 timeout: 5000 # Warning: The database defined as 'test' will be erased and # re-generated from your development database when you run 'rake'. # Do not set this db to the same as development or production. test: adapter: sqlite3 database: db/test.sqlite3 timeout: 5000 production: adapter: sqlite3 database: db/production.sqlite3 timeout: 5000

Run scaffolding script to create columns for (future) tables… notice it creates db/migrate file C:\InstantRails\rails_apps\comics_catalog>ruby script/generate scaffold comic ti tle:string issue:integer publisher:string :0:Warning: Gem::SourceIndex#search support for Regexp patterns is deprecated exists app/models/ exists app/controllers/ exists app/helpers/ create app/views/comics exists app/views/layouts/ exists test/functional/ exists test/unit/ 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 dependency model :0:Warning: Gem::SourceIndex#search support for Regexp patterns is deprecated 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/001_create_comics.rb create app/controllers/comics_controller.rb create test/functional/comics_controller_test.rb create app/helpers/comics_helper.rb route map.resources :comics C:\InstantRails\rails_apps\comics_catalog>

Run rake to create dbs C:\InstantRails\rails_apps\comics_catalog>rake db:migrate --trace (in C:/InstantRails/rails_apps/comics_catalog) ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:migrate == 1 CreateComics: migrating ================================================== -- create_table(:comics) -> s == 1 CreateComics: migrated (0.1090s) ========================================= ** Invoke db:schema:dump (first_time) ** Invoke environment ** Execute db:schema:dump C:\InstantRails\rails_apps\comics_catalog>

Believe it or not… We’ve created our comics site. There are two servers that come with RoR. We need to start a server. To check out our site run: ruby script/server C:\InstantRails\rails_apps\comics_catalog>ruby script/server => Booting Mongrel (use 'script/server webrick' to force WEBrick) => Rails application starting on => Call with -d to detach => Ctrl-C to shutdown server ** Starting Mongrel listening at :3000 ** Starting Rails with development environment...

Localhost:3000/comics opens the scaffolded CRUD functionality page

Creating comics