• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Intro to Rails
 

Intro to Rails

on

  • 539 views

LVRUG meetup

LVRUG meetup

Statistics

Views

Total Views
539
Views on SlideShare
534
Embed Views
5

Actions

Likes
0
Downloads
7
Comments
0

1 Embed 5

http://www.hanrss.com 5

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

    Intro to Rails Intro to Rails Presentation Transcript

    • Agile Web Development
      with Rails (for 3.1)
      Ya, that book
      @LVRUG - Jeremy Woertink
    • What is "Rails" you ask?
      "Ruby on Rails is a framework that makes it easier to develop, deploy, and maintain web applications."
      "Rails applications are written in Ruby, a modern, object-oriented scripting language."
    • What is "Rails" you ask?
      • Web Development Framework
      • MVC Architecture
      • Written in Ruby
      • Convention over Configuration
      • RESTful
      • Agile
      • Clean
      more info given in the Introduction section
    • Who uses it?
    • Websites on Rails
      • Yellow Pages
      • Groupon
      • Living Social
      • Github
      • Funny or Die!
      • Pololu
      • Cardplayer
      • ScripSmart
      • and lots of Russ's pr0n....
    • Where's the start button?
    • Installation
      You're in luck, it's a gem! :)
      $ sudo gem install rails
      sudo may not be needed...
    • Checklist
      • Know what it is? CHECK
    • Checklist
      • Know what it is? CHECK
      • Know who uses it? CHECK
    • Checklist
      • Know what it is? CHECK
      • Know who uses it? CHECK
      • Know where to get it? CHECK
    • Checklist
      • Know what it is? CHECK
      • Know who uses it? CHECK
      • Know where to get it? CHECK
      • Know how to use it? NOPE. Chuck Testa
    • Gettin' REAL dirty
      $ cd websites
      websites$ rails new demo
      create lots of stuff
      run bundle install
      Fetching source index for http://rubygems.org/
      Your bundle is complete!
      websites$ cd demo
      demo$ rails server
      => Booting WEBrick
      => Rails 3.1.0 application starting in development on http://0.0.0.0:3000
    • http://localhost:3000
    • Hello, Rails!
      demo$ rails generate controller Say hello goodbye
      create more stuff...
      invoke things
      route whatever
    • Hello, Rails!
      demo$ rails generate controller Say hello goodbye
      create more stuff...
      invoke things
      route whatever
      Visit http://localhost:3000/say/hello
    • ZOMG! What happened?
      • created "SayController"
      • app/controllers/say_controller.rb
      • created views for "say"
      • app/views/say/hello.html.erb
      • app/views/say/goodbye.html.erb
      • updated routes with "say" routes
      • config/routes.rb
      • created other super secret squirrel stuff (i.e. assets, tests, helper)
    • app/controllers/say_controller.rb
      classSayController < ApplicationController
      defhello
      end
      defgoodbye
      end
      end
    • app/controllers/say_controller.rb
    • app/views/say/hello.html.erb
      • say - The name of the controller
      • hello - The name of the action
      • html - The end format we want
      • js, xml, text...
      • erb - The ruby templating system
      • haml, slim, mustache, liquid...
    • app/views/say/hello.html.erb
      <h1>Say#hello</h1>
      <p>Find me in app/views/say/hello.html.erb</p>
    • app/views/say/hello.html.erb
      <h1>Hello from Rails!</h1>
      <p>It is now <%= Time.now %></p>
    • http://localhost:3000/say/hello
    • app/controllers/say_controller.rb
      classSayController < ApplicationController
      defhello
      @time =Time.now
      end
      defgoodbye
      end
      end
    • app/views/say/hello.html.erb
      <h1>Hello from Rails!</h1>
      <p>It is now <%= @time %></p>
    • Fancy pants time!
    • app/views/say/hello.html.erb
      <h1>Hello from Rails!</h1>
      <p>It is now <%= @time %></p>
      <p>
      Time to say
      <%= link_to("Goodbye", say_goodbye_path) %>!
      </p>
    • http://localhost:3000/say/hello
    • app/views/say/goodbye.html.erb
      <h1>Say#goodbye</h1>
      <p>Find me in app/views/say/goodbye.html.erb</p>
    • app/views/say/goodbye.html.erb
      <h1>Beer time?</h1>
      <blink>Holla atchya boy!</blink>
      <span>
      Say
      <%= link_to("Hello", say_hello_path) %> again.
      </span>
    • app/views/say/goodbye.html.erb
      <h1>Beer time?</h1>
      <blink>Holla atchya boy!</blink>
      <span>
      Say
      <%= link_to("Hello", say_hello_path) %> again.
      </span>
      ahh yeah, you love the blink tag don't ya!
    • Recapitulation time!
      • Installed rails
      • Created a new application
      • Generated controller and views
      • Added dynamic content
      • Linked pages together
    • Questions?!