Passing Arguments to an Action

I have spent a fair amount of time searching to find information on
how one would pass arguments to an action (presumably some sort of URL
appendage). It would seem to me that that would be something that
would be done quite frequently. Judging from the extremely small
amount of information that I recovered, I think that I again must be
bucking the Rails way of doing things. So, the question is: If
passing arguments to an action is something that is frequently done in
Rails, how does one do it? It that isn’t the case because I am
missing something, could someone please clue me in on what I’m
missing.

Thanks for any input.

   ... doug

I have spent a fair amount of time searching to find information on
how one would pass arguments to an action (presumably some sort of URL
appendage). It would seem to me that that would be something that
would be done quite frequently. Judging from the extremely small
You can do <%= link_to “Pass some
arguments”,:controller=>“mycontroller”,:action=>“myaction”,:id=>35,:colour=>“green”,:flavour=>“orange”
%>

This will use config/routes.rb to figure out how to structure the
actual URL. If you haven’t customised it, you’ll get /controller/
myaction/35?colour=green&flavour=orange.

Gwyn.

Maybe you could integrate a small solution on how to use those
arguments later on?

Maybe you could integrate a small solution on how to use those
arguments later on?
Sorry, I should’ve mentioned - the values will be accessible in the
‘params’ hash:

params[:id] == 35
params[:colour] == “green”
params[:flavour] == “orange”

Gwyn.

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