User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Ruby section within the Web Development category of DaniWeb, a massive community of 397,816 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,575 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Ruby advertiser: SELL YOUR PRODUCT TODAY !
Views: 3931 | Replies: 8
Reply
Join Date: Nov 2006
Location: new delhi
Posts: 38
Reputation: amithasija is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
amithasija amithasija is offline Offline
Light Poster

query string

  #1  
May 16th, 2007
can anybody tell me how to get the values from querystring.

thanx in advance to all..
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2005
Location: Manchester, UK
Posts: 481
Reputation: pty is on a distinguished road 
Rep Power: 3
Solved Threads: 31
pty's Avatar
pty pty is offline Offline
Posting Pro in Training

Re: query string

  #2  
May 20th, 2007
Originally Posted by amithasija View Post
can anybody tell me how to get the values from querystring.

thanx in advance to all..


  1. params[:param_name]

So say for example you're using pagination and you want the page_number param list?page_number=1:



  1. params[:page_number]
Note to self... pocket cup
Reply With Quote  
Join Date: Nov 2006
Location: new delhi
Posts: 38
Reputation: amithasija is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
amithasija amithasija is offline Offline
Light Poster

Re: query string

  #3  
May 21st, 2007
thanx pty for quick reply,

but if i have suppose 7 parameters in query string and i want to access the value for all 7 parameters in one go, how can i do that..
Reply With Quote  
Join Date: Oct 2005
Location: Manchester, UK
Posts: 481
Reputation: pty is on a distinguished road 
Rep Power: 3
Solved Threads: 31
pty's Avatar
pty pty is offline Offline
Posting Pro in Training

Re: query string

  #4  
May 21st, 2007
Originally Posted by amithasija View Post
thanx pty for quick reply,

but if i have suppose 7 parameters in query string and i want to access the value for all 7 parameters in one go, how can i do that..


The params are in a hash (eg {"action"=>"list", "filter"=>"closed", "controller"=>"issue"}. If you want to iterate through them for example use:

  1. params.each do |key, value|
  2. #do something fancy!
  3. end
Note to self... pocket cup
Reply With Quote  
Join Date: Nov 2006
Location: new delhi
Posts: 38
Reputation: amithasija is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
amithasija amithasija is offline Offline
Light Poster

Re: query string

  #5  
May 21st, 2007
hi pty,

is there any special function to retrive the complete query string path,i have read from manual that this function is used to retrieve complete string,
ENV['QUERY_STRING'],but i am not able to get it working.
Reply With Quote  
Join Date: Nov 2003
Location: Toronto, Canada
Posts: 354
Reputation: Gary King will become famous soon enough Gary King will become famous soon enough 
Rep Power: 6
Solved Threads: 5
Colleague
Gary King's Avatar
Gary King Gary King is offline Offline
PHP/vBulletin Guru

Re: query string

  #6  
May 22nd, 2007
env["QUERY_STRING"] should work.
Reply With Quote  
Join Date: Nov 2006
Location: new delhi
Posts: 38
Reputation: amithasija is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
amithasija amithasija is offline Offline
Light Poster

Re: query string

  #7  
May 23rd, 2007
thanx gary for your reply but i want to know that ,do i need to install or include some file to get it working as its not working if i only add this line of code only.
Reply With Quote  
Join Date: Nov 2003
Location: Toronto, Canada
Posts: 354
Reputation: Gary King will become famous soon enough Gary King will become famous soon enough 
Rep Power: 6
Solved Threads: 5
Colleague
Gary King's Avatar
Gary King Gary King is offline Offline
PHP/vBulletin Guru

Re: query string

  #8  
May 23rd, 2007
Try using controller.env['QUERY_STRING'], where controller is the name of the controller where you are using this.
Last edited by Gary King : May 23rd, 2007 at 12:40 pm.
Reply With Quote  
Join Date: Jun 2007
Posts: 1
Reputation: aoooddy is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
aoooddy aoooddy is offline Offline
Newbie Poster

Re: query string

  #9  
Jun 7th, 2007
internet explorer download
---------------------------------------
http://www.greatdownload.org
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Ruby Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Ruby Forum

All times are GMT -4. The time now is 6:34 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC