Hi. Is it possible to refer to a parameter from a page in another controller?
Paul Roche wrote in post #964999:
Hi. Is it possible to refer to a parameter from a page in another controller?
Your question is unclear as stated. More details?
Best,
rom a page in another controller?
means…
Sure. I have a page in (view\controller x) with an input field. Submitting the form displays the value of the input field on this same page.
There is a link on this page that connects to another page in a different view/controller (view\controller y). I want to use the param (input field value) as a conditon in a 'find' in the controller y. But I am not yielding results. It's like the param is empty. I hope this makes it a little clearer
basically you got two possibilities:
1. write the value into a session-variable
session[:object] = "some string or value"
2. pass your value as a parameter to some action and read params in
your controller:
view:
<%= link_to "my_action" :controller => :bla, :action
=> :my_action, :object => "some string or value" %>
controller:
def my_action
puts params[:wtf]
end
Thanks