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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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- s.net> wrote:> 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 > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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- s.net> wrote:> 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 > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---