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:
**************************************************************************
<p align="center"><font size="24"><%= @message %></font></p>
<p align="center"><font size="20">Last Summer, I travelled through
Europe on a beer tasting extravaganza!</font></p>
<p align="center"> <%= link_to image_tag("europe.jpg"), :height =>
"25%", :width => "25%", :controller => "beers", :action => "beer1",
%></p>
<p align="center"><font size="8">[ Click the frothy beverage above ...
]</font></p>
***************************************************************************
Below is the view for "beers1" method.
**************************************************************************
<p align="center"><%= link_to image_tag "cerna.jpg", :height => "25%",
:width => "25%", :controller => "beers", :action => "beers2" %></p>
<p align="center"><font size="18"><%= @message1 %></font></p>
<p align="center"><font size="8">[ Click the image to see more beer ]
</font></p>
**************************************************************************
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!
on 2012-11-19 19:17
on 2012-11-19 21:10
On 19 November 2012 18:17, Joz Private <lists@ruby-forum.com> wrote:
> So I've just dipped into Rails and I'm completely lost ...
I suggest working through a good tutorial such as railstutorial.org
(which is free to use online). This will show you the basics of
rails.
Colin
on 2012-11-19 23:44
On Mon, Nov 19, 2012 at 10:17 AM, Joz Private <lists@ruby-forum.com> wrote: > So I've just dipped into Rails and I'm completely lost ... > <p align="center"><font size="24"><%= @message %></font></p> Besides the excellent suggestion to work through a Rails tutorial -- If you intend to do web development, please please please learn to write proper HTML and CSS. If nothing else, a glance at the generated markup via `view source` would show you exactly why your page doesn't change, and provide an immediate clue how to fix it. -- Hassan Schroeder ------------------------ hassan.schroeder@gmail.com http://about.me/hassanschroeder twitter: @hassan
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.