Getting params from one view into another

Hi Ruby Forum,

I have a situation that I have never run into before. I need to pass a
param from one view into a different section of my controller.

I’m having a bit of trouble passing a variable from my view into another
part of my controller in order to control what IP address is used to
have the graph applied.
I want to pass the IP address to the controller from the view as
[:text1] in this example into “one” in my controller.

Normally, when I pass a param, it is used in the same part of the
controller…ie, in this case: “view”…not in this case. I need to pass
the param from the view page into “one” in order to see the graph I’m
generating.


def view
input = params[:text1]
input.chomp
@graph = open_flash_chart_object(950,400, ‘/look/one’, false, ‘/’)
end

def one
@tester = Tester.find(:all, :conditions => "ipadd = ‘10.1.1.2’ and label

‘2008-01-01 00:00:00’", :order => ‘label’)
end


Is there a way to pass it from view into one?

thanks

jackster

Hi,
in the view action, you can - “$input = params[:text1]” ; then in
one action, fetch it out, such as " puts “this is s: #{s}” ".
$input makes it as a global variable.
Hope it solves your issue.

Br,
Myst

On 1ÔÂ12ÈÕ, ÏÂÎç1ʱ44·Ö, jackster the jackle <rails-mailing-l…@andreas-

Hi,
Two methods:
1.
in the view action, you can - “$input = params[:text1]” ; then in
one action, fetch it out, such as " s = $input; puts “this is s: #{s}”
".
$input makes it as a global variable.
2.
you can build a “form” in the view.rhtml, and deliver the
params[:text1] by this form to the next action “one”

Hope it solves your issue.

Br,
Myst

On 1ÔÂ12ÈÕ, ÏÂÎç1ʱ44·Ö, jackster the jackle <rails-mailing-l…@andreas-

On 1ÔÂ12ÈÕ, ÏÂÎç1ʱ44·Ö, jackster the jackle <rails-mailing-l…@andreas-

myst_tt wrote:

Hi,
Two methods:
1.
in the view action, you can - “$input = params[:text1]” ; then in
one action, fetch it out, such as " s = $input; puts “this is s: #{s}”
".
$input makes it as a global variable.
2.
you can build a “form” in the view.rhtml, and deliver the
params[:text1] by this form to the next action “one”

Hope it solves your issue.

Br,
Myst

On 1��12��, ����1ʱ44��, jackster the jackle <rails-mailing-l…@andreas-

On 1��12��, ����1ʱ44��, jackster the jackle <rails-mailing-l…@andreas-

Both great ideas…thanks for helping me out with this

jackster.mobi

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs