Forum: Ruby on Rails Params Help to Pass variables from URL

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bing T. (Guest)
on 2006-04-25 08:48
Hi guys,

I'm new to ruby on rails and am realy quite having a problem with
passing values. I created a test folder and have 3 files:

1. Main.rhtml

<%= render_component(:controller => "test", :action => "pass") %>

2. Pass.rhtml

<%=@test%>
<%=flash[:notice]%>

3. Controller.rb

class TestController < ApplicationController


def pass

@test =  "<a href=\"main?name=123\">Testing!</a>"
@passed = params[:name]
#flash[:notice] = '456'
flash[:notice] = @passed

end

end


Well, as much as I get the url properly to simulate the passing of
variables:
www.mysite.com/test/main to www.mysite.com/test/main?name=123

I can't seem to get the value of name rendered to my page which is
suppose to be 123.

Would really appreciate your help!

Thanks in advance!

sombrero
This topic is locked and can not be replied to.