Presentation is loading. Please wait.

Presentation is loading. Please wait.

Ruby on What? A brief introduction to Rails Christopher Hoskin Faculty of History 12th Annual IT Support Staff Conference 21st June 2007, St. Catherine's.

Similar presentations


Presentation on theme: "Ruby on What? A brief introduction to Rails Christopher Hoskin Faculty of History 12th Annual IT Support Staff Conference 21st June 2007, St. Catherine's."— Presentation transcript:

1 Ruby on What? A brief introduction to Rails Christopher Hoskin Faculty of History 12th Annual IT Support Staff Conference 21st June 2007, St. Catherine's College

2 Ruby on Rails ● Overview – What is Ruby? What is Rails? – Who's backing it? ● Demo 1 – Simple seminar application ● How does it work? ● Demo 2 – Customised seminar application

3 Ruby ● Created by Yukihiro “matz” Matsumoto ● Dual GPL / Ruby licence ● Dynamic, reflective, object-oriented scripting language

4 Rails ● Open-source (MIT) web framework ● By David Heinemeier Hansson (37signals) ● Rails Mantra – Opinionated Software – Convention over Configuration – DRY (Don't Repeat Yourself)

5 Who's using it? ● 37signals – (Basecamp, Highrise, Campfire, Backpack) ● Joyant – (Hosting, Collaboration, Slingshot) ● Relevance – (Training, Consultancy, Streamlined) ● Active Reload – (Lighthouse, Mephisto)

6 So no one we've heard of? ● The BBC – http://open.bbc.co.uk/catalogue/infax/ http://open.bbc.co.uk/catalogue/infax/ ● Amazon – http://unspun.amazon.com/ http://unspun.amazon.com/ ● The Leaky Cauldron – http://www.the-leaky-cauldron.org/ http://www.the-leaky-cauldron.org/

7 Ruby 1.8 Single pass interpreter YARVM (Ruby 2.0) Ruby on Rails on...? Ruby Rails Parrot Cardinal JVM JSR 223 JRuby CLR DLR Iron Ruby All trademarks and copyrights are the property of their respective owners.

8 Vendor Tools Orcas RDT DLTK All trademarks and copyrights are the property of their respective owners.

9 MVC Controller ActionController View ActionView Prototype Scriptaculous Model ActiveRecord Migrations Database

10 Databases ● MySql (default) ● PostgreSQL ● SQLite ● Microsoft SQL Server – Native on Windows, via FreeTDS on *nix ● IBM DB2 ● Oracle ● Several others

11 Demo 1 - Aims ● Create a new rails project - seminars ● Set up models, controllers ● Set up database with migrations ● Install and use Active_Scaffold plugin

12 Seminar – Class Diagram

13 What did we do? ● Rails created initial application ● We defined tables with migrations ● We set up the model – joins specified with has_many & belongs_to – DRY: No need to specify the fields ● Active Scaffold provided controller & view

14 has_many... belongs_to ● Seminar has_many :sessions e.g. – sem.sessions.create(:date => '2007-06-21') – next = sem.sessions.find(:first, :conditions => [“date > ?”, today]) ● Session belongs_to :seminar e.g. – sem_title = sess.seminar.title – sess.seminar = sem;

15 has_many :sessions ● Configuration over convention – assumes foreign key in seminar_id in session table ● Can be customised – has_many :sessions, :order => :date, :dependent => :delete_all ● Or write your own – has_many :sessions, :finder_sql => 'select date from sessions where seminar_id=#{id}'

16 Demo 2 - Aims ● Session view with paper panel – Simple custom view – Simple demonstration of use of AJAX ● Order papers in session – Drag and drop papers in browser – Still very simple

17 Integration Database Database Business Logic Triggers Stored Procedures App1App2 App3 XML Native Protocol ODBC App4 SOAP App5 COBRA


Download ppt "Ruby on What? A brief introduction to Rails Christopher Hoskin Faculty of History 12th Annual IT Support Staff Conference 21st June 2007, St. Catherine's."

Similar presentations


Ads by Google