Introduction To Rails

19
Introduction Introduction to Ruby on Rails to Ruby on Rails Web development Web development that doesn’t hurt.” that doesn’t hurt.” Eric J. Gruber

description

Introduction to the Ruby programming language the the Ruby on Rails framework.

Transcript of Introduction To Rails

Page 1: Introduction To Rails

IntroductionIntroductionto Ruby on Railsto Ruby on Rails

““Web development Web development

that doesn’t hurt.”that doesn’t hurt.”

Eric J. Gruber

Page 2: Introduction To Rails

About RubyAbout Ruby

Released in 1995Released in 1995 Open sourceOpen source Available for:Available for:

– WindowsWindows– Mac OS XMac OS X– LinuxLinux

Ruby home: Ruby home: http://www.ruby-lang.org/enhttp://www.ruby-lang.org/en// Try Ruby!: Try Ruby!: http://http://tryruby.hobix.comtryruby.hobix.com

Page 3: Introduction To Rails

About RubyAbout Ruby Dynamic language, like PHPDynamic language, like PHP Clean syntax, natural wording, easy to readClean syntax, natural wording, easy to read

– C#:C#: public class Hello1 { public static public class Hello1 { public static void Main() void Main() { System.Console.WriteLine("Hello, { System.Console.WriteLine("Hello, World!"); } } World!"); } }

– ASP.NET:ASP.NET: <% HelloWorldLabel.Text = <% HelloWorldLabel.Text = “Hello, World!”; %>“Hello, World!”; %>

– PHP:PHP: <?php print “Hello, World!”; ?> <?php print “Hello, World!”; ?>– Ruby:Ruby: puts “Hello, World!” puts “Hello, World!”

Page 4: Introduction To Rails

About RubyAbout Ruby

Everything is an object in RubyEverything is an object in Ruby

Images from the book Simply Rails 2 by Patrick Lenz

Page 5: Introduction To Rails

RubRubyy

RailsRails

meetmeet

Page 7: Introduction To Rails

Other success storiesOther success stories

From ruby-lang.org:From ruby-lang.org:– http://ruby-http://ruby-lang.orglang.org

/en/documentation/success-stories/en/documentation/success-stories

From rubyonrails.org:From rubyonrails.org:– http://http://rubyonrails.orgrubyonrails.org/applications/applications

Page 8: Introduction To Rails

What is Ruby on Rails?What is Ruby on Rails?

Web framework, powered by Ruby, Web framework, powered by Ruby, extracted from the highly successful extracted from the highly successful project management web application, project management web application, Basecamp. Basecamp. http://http://basecamphq.combasecamphq.com

Page 9: Introduction To Rails

Framework? What’s that?Framework? What’s that?

A A frameworkframework is a basic conceptual is a basic conceptual structure used to solve or address structure used to solve or address complex issues. This very broad complex issues. This very broad definition has allowed the term to be definition has allowed the term to be used as a buzzword, especially in a used as a buzzword, especially in a software context. software context. – http://http://en.wikipedia.orgen.wikipedia.org/wiki/Framework/wiki/Framework

Page 10: Introduction To Rails

In other words …In other words …

… … it’s like magic!it’s like magic!

Page 11: Introduction To Rails

Why should I care?Why should I care?

Easy validationsEasy validations Better separation Better separation

of codeof code– HTML, CSS (views)HTML, CSS (views)– Database, business Database, business

logic (models)logic (models)– User interface, User interface,

application logic application logic (controllers)(controllers)

Works well with Works well with AjaxAjax

Good amount of Good amount of resources available resources available to learnto learn

Easy for designers, Easy for designers, fun for fun for programmersprogrammers

Database agnosticDatabase agnostic

Do more with fewer Do more with fewer resourcesresources

Page 12: Introduction To Rails

Everything is in its right Everything is in its right placeplace

Embrace your Embrace your constraintsconstraints

Don’t Repeat Don’t Repeat YourselfYourself

Every Rails app Every Rails app has the same file has the same file structurestructure

Image from the book RailsSpace by Michael Hartl and Aurelius Prochazka

Page 13: Introduction To Rails

DemoDemo

Page 14: Introduction To Rails

How to get startedHow to get started Use the Ruby on Rails download page:Use the Ruby on Rails download page:

– http://http://rubyonrails.orgrubyonrails.org/download/download, or …, or … Windows users can download InstantRails Windows users can download InstantRails

for the total package:for the total package:– http://http://instantrails.rubyforge.org/wiki/wiki.plinstantrails.rubyforge.org/wiki/wiki.pl

Mac users can download Locomotive for a Mac users can download Locomotive for a quick test run (might need to be updated):quick test run (might need to be updated):– http://http://sourceforge.netsourceforge.net/projects/locomotive//projects/locomotive/

Linux users can … it depends on your Linux users can … it depends on your distrodistro

Sign up free at Sign up free at http://http://herokugarden.comherokugarden.com

Page 15: Introduction To Rails

Recommended Ruby Recommended Ruby readingreading

Learn to Program, 2Learn to Program, 2ndnd

Edition Edition

– PragProg.comPragProg.com

Programming Ruby 1.9Programming Ruby 1.9– PragProg.comPragProg.com

Great for beginners

A lot more advanced

Page 16: Introduction To Rails

Recommended Rails Recommended Rails readingreading

Simply Rails 2.0Simply Rails 2.0– Sitepoint.comSitepoint.com

Agile Web Development with Agile Web Development with RailsRails– PragProg.comPragProg.com

Great for beginners

A little bit more

advanced

Page 17: Introduction To Rails

ResourcesResources Ruby on Rails: Talk (Google Group)Ruby on Rails: Talk (Google Group)

– http://http://groups.google.com/group/rubyonrailsgroups.google.com/group/rubyonrails-talk-talk Railscasts (free Ruby on Rails screencasts)Railscasts (free Ruby on Rails screencasts)

– http://http://railscasts.comrailscasts.com Peep Code (paid Rails-related screencasts)Peep Code (paid Rails-related screencasts)

– http://http://peepcode.compeepcode.com Phusion Passenger (easy deployment Phusion Passenger (easy deployment

module)module)– http://http://www.modrails.comwww.modrails.com

Agile Web Development (plugin central)Agile Web Development (plugin central)– http://http://agilewebdevelopment.comagilewebdevelopment.com//

Page 18: Introduction To Rails

HostingHosting

http://http://slicehost.comslicehost.com http://railsplayground.comhttp://railsplayground.com http://www.site5.comhttp://www.site5.com http://dreamhost.comhttp://dreamhost.com http://hostgator.comhttp://hostgator.com Web Hosting Services Which Support Web Hosting Services Which Support

Ruby on RailsRuby on Rails (from Rails Wiki) (from Rails Wiki)

Page 19: Introduction To Rails

Questions?Questions?