Passing a value from one rhtml to another

I’m trying to find a way to get from one rhtml page to another and
taking a value along to use in the second page. Basically a user clicks
on one of many download links and what should appear on the next page is
all the available stuff related to that download, so I think if I take
the id number of the first page then i can use if statements in the
second page? Sorry if that sounds completely mad - I’m Java based so
this is all a bit over my head atm!

Thanks alot,
Bex

Ioana K. wrote:

Hi,
Let’s say u have x.rhtml: <%=link_to ‘download’, :action => ‘y’, :id
=> 4%> and y.rhtml
Inside the controller do smth like:
def y
@id = params[:id]
end

also possible to access the params[:id] as (how awkward!) as params[:id]
instead of defining the @id…i suppose both ways are good - -

so you could do:
x.rhtml
<%= link_to ‘download’ , :action => ‘y’, :blabber => someparameter %>

and then put <%= params[:blabber]%> in y.rhtml which will output
someparameter.
hope it helps,

shai

Hi,
Let’s say u have x.rhtml: <%=link_to ‘download’, :action => ‘y’, :id
=> 4%> and y.rhtml
Inside the controller do smth like:
def y
@id = params[:id]
end
Then in y.rhtml: <%= @id%> //=> 4
Hope that’s what you expected to know.

Cheers,
ioana k&a