Hey all, I have a rails app that needs to process some query string (GET) data from another website not in my control. A typical user will go to this other website and will see links to my web app. The problem is, I have no control of the format of the query string. Right now, it looks like this: www.myrailsapp.com/process?index=12&docrefno=44&org=440000&fund=P56756<http://www.myrailsapp.com/process?index=12&docrefno=44&org=440000&fund=P56756> The only part I can control is whatever comes before the ''?'' Does rails provide functionality to get the query string variables? Thanks, Jin _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On Aug 29, 2005, at 2:23 PM, Jin Lee wrote:> Hey all, > > I have a rails app that needs to process some query string (GET) > data from another website not in my control. A typical user will go > to this other website and will see links to my web app. > > The problem is, I have no control of the format of the query > string. Right now, it looks like this: > > www.myrailsapp.com/process?index=12&docrefno=44&org=440000&fund=P56756 > > The only part I can control is whatever comes before the ''?'' > > Does rails provide functionality to get the query string variables? > > Thanks, > > Jin > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >Yes this works fine. You can reference the GET vars like so: params[:index], params[:docrefno], params[:org], params[:fund] and so on. HTH -Ezra Zygmuntowicz WebMaster Yakima Herald-Republic Newspaper ezra-gdxLOakOTQ9oetBuM9ipNAC/G2K4zDHf@public.gmane.org 509-577-7732 _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
application_root/config/routes.rb ... read about it and learn how to use it. On 8/29/05, Jin Lee <jinslee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hey all, > > I have a rails app that needs to process some query string (GET) data from > another website not in my control. A typical user will go to this other > website and will see links to my web app. > > The problem is, I have no control of the format of the query string. Right > now, it looks like this: > > www.myrailsapp.com/process?index=12&docrefno=44&org=440000&fund=P56756 > > The only part I can control is whatever comes before the ''?'' > > Does rails provide functionality to get the query string variables? > > Thanks, > > Jin > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-- Zachery Hostens <zacheryph-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Jin Lee wrote:> www.myrailsapp.com/process?index=12&docrefno=44&org=440000&fund=P56756 > > The only part I can control is whatever comes before the ''?'' > > Does rails provide functionality to get the query string variables?Yes, they''ll be available in params, as always. Ie params[''org''] should give you ''440000'' in the above example. -- Jakob L. Skjerning - http://mentalized.net
Jin Lee wrote:> Hey all, > > I have a rails app that needs to process some query string (GET) data > from another website not in my control. A typical user will go to this > other website and will see links to my web app. > > The problem is, I have no control of the format of the query string. > Right now, it looks like this: > > www.myrailsapp.com/process?index=12&docrefno=44&org=440000&fund=P56756 > <http://www.myrailsapp.com/process?index=12&docrefno=44&org=440000&fund=P56756> > > The only part I can control is whatever comes before the ''?'' > > Does rails provide functionality to get the query string variables?Display the request parameters (<%= params.inspect %> in your view). I think you''ll see they''re all there. So something like params[:index] would give you "12" in your example.