Web Development with Ruby on Rails

Bettina Lechner

UNO Techademy 2015

Introductions

  • What's your name?
  • Which school do you go to?
  • What's your favorite movie?

/movies/42

 

/movies/:id => movies_controller@show(42)

Web Server

/config/routes.rb

Movie Controller

/app/controllers/movies_controller.rb

def show
    current_movie = Movie.find(42)
end

Movie Model

/app/models/movie.rb

SELECT * FROM movies WHERE id = 42;

Movie Controller

/app/controllers/movies_controller.rb

render 'show' with current_movie

Movie Show View

/app/views/movies/show.html.erb

<h1><%= movie.title %> (<%= movie.year %></h1>
<p><%= movie.rating %>/10 Stars</p>
<h2><%= movie.description %></h2>
<h1>Inside Out (2015)</h1>
<p>9/10 Stars</p>
<h2>After young Riley is uprooted from...</h2>

What we'll use

  • cloud9.io to write and run our app
  • git and github to keep track of our code
Made with Slides.com