Passing Multiple Values In URL


#1

Been a while since I programmed in Ruby and Rails and some of the
basic concepts I just loose so quickly. This one I can’t find any
examples of.

I want to pass two pieces of information in my URL. The :id plus I
want to pass my user_id. How do I pass it using the link_to?

Stupid question I know… but I can’t find the answer.

John K.
http://www.kopanas.com

=====================================================================
http://www.soen.info - source of the freshest software engineering
information on the net
http://cusec.soen.info - software engineering conference


#2

On Sat, 2006-02-11 at 19:05 -0500, John K. wrote:

Been a while since I programmed in Ruby and Rails and some of the
basic concepts I just loose so quickly. This one I can’t find any
examples of.

I want to pass two pieces of information in my URL. The :id plus I
want to pass my user_id. How do I pass it using the link_to?

Stupid question I know… but I can’t find the answer.


http://rails.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html

Craig


#3

Thanks, I have tried there, I personally could not find anything
there, I was wondering if someone had an example I can work from?

On 11-Feb-06, at 7:17 PM, Craig W. wrote:

http://rails.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html

Craig


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

John K.
http://www.kopanas.com

=====================================================================
http://www.soen.info - source of the freshest software engineering
information on the net
http://cusec.soen.info - software engineering conference


#4

link_to ‘fake url’, :action => ‘fake_action’, :id => 5, :user_id => 7


#5

Thanks Pat. Is there a way to get it so that the URL appears like:

http://www.something.com/controller/fake_action/5/user_id/7

instead of:

http://www.something.com/controller/fake_action/5?user_id=7

Thanks! :slight_smile:

On 11-Feb-06, at 7:29 PM, Pat M. wrote:

Stupid question I know… but I can’t find the answer.


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

John K.
http://www.kopanas.com

=====================================================================
http://www.soen.info - source of the freshest software engineering
information on the net
http://cusec.soen.info - software engineering conference


#6

In your routes.rb file put:

map.connect ‘:controller/:action/:id/user_id/:user_id’