# Ruby on Rails is a Framework for Web Applications. # it follows the model - view - controller pattern. # One Application has to consist of several files # # You can find the whole source on github: # http://github.com/bjelline/bottle/tree/master # and test the application on heroku # http://bottles.heroku.com/ ------------------ config/routes.rb ------------------- # in this file the mapping from URL to controller is defined ActionController::Routing::Routes.draw do |map| map.root :controller => "wall" map.resources :wall, :singular => :wall_instance end ------------------ app/controller/wall.rb ------------------- class WallController < ApplicationController def show @i = params[:id].to_i end end ------------------ app/views/wall/index.html.erb -------------
<%= link_to "Sing the song", :controller => :wall, :action => :show, :id => 99 %>
------------------ app/views/wall/show.html.erb ------------- <% while @i > 0 do %>
<%= say_bottles(@i) %> of beer on the wall,
<%= say_bottles(@i) %> of beer.
<%
@i = @i - 1
%>
Take one down and pass it around,
<%= say_bottles(@i) %> of beer on the wall.
No more bottles of beer on the wall, no more bottles of beer.
Go to the store and buy some more, 99 bottles of beer on the wall.