So I’ve just dipped into Rails and I’m completely lost …
I have a very simple website. There are 2 layouts, application and
welcome.
The route begins at the welcome layout.
The “main” controller is connected to the “welcome” layout, and has one
method, so this method’s view gets inserted at the yield block. It
inserts an image that when you click it, brings you to a new page. This
new page has a new layout “application”. The controller “beers” is
connected to this layout and has three methods, beers1, beers2, food.
Below is the view that gets inserted in “welcome” layout:
<%= @message %>
Last Summer, I travelled through Europe on a beer tasting extravaganza!
<%= link_to image_tag("europe.jpg"), :height => "25%", :width => "25%", :controller => "beers", :action => "beer1", %>
[ Click the frothy beverage above ... ]
Below is the view for “beers1” method.
<%= link_to image_tag "cerna.jpg", :height => "25%", :width => "25%", :controller => "beers", :action => "beers2" %>
<%= @message1 %>
[ Click the image to see more beer ]
I would like also to be able to click on this image and go to another
new page. This new page is simply the “application” layout again but
with the view “beers2” inserted at the yield block instead…
How do I do this?
I’ve tried the above but it just won’t work, the page won’t change!