Forum: Ruby on Rails Params Documentation?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
6329e9ce6b0c23f8bcf64a6c46a2bb81?d=identicon&s=25 matt (Guest)
on 2006-12-28 20:17
(Received via mailing list)
Is there any documentation on the params method that gets returned
from .rhtml forms?

I looked in the RDocs for Rails / Ruby and found a brief glimpse in the
CGI module, but it isn't well defined there.

I'm wanting to know *exactly* where it gets its arguments from.

Too often I've seen params[:id] or params[:foo][:bar], without really
understanding where that data is coming from.

I thought that it would come from the 'name' parameter in the form, or
maybe even all the 'name's put into an Array or Hash, but I can't find
any docs to confirm nor deny.

from the console I tried params.class, and it doesn't know about about
params, so I'm missing something.

72f8ab180f81f9c544e2b58da399c0be?d=identicon&s=25 Elad Meidar (eizesus)
on 2006-12-28 20:57
(Received via mailing list)
Hi Matt,

Params are basically what being sent from a form in a rhtml (or html)
the keys within the hash (params[:key1], params[:key2] for ex.) are the
names of the form input tags in the document.

if i have a text field for example:

<input type="text" name="username" />

than when i post this form to a controller action, params will contain
6329e9ce6b0c23f8bcf64a6c46a2bb81?d=identicon&s=25 matt (Guest)
on 2006-12-28 23:03
(Received via mailing list)
OK.  That part I get, but how would the rhtml look for something that
returns: params[:user][:f_name] ?

And the docs mention something like:
<input type="text" name="username[]" />
 so that you can access multiple params, but I didn't gather how I would
retrieve it in the controller.

And often times there is a call in a controller such as params[:user]
that is filling in all sorts of extra information (,,
etc)  How is that rhtml generated?

Also, the docs are using both the id and name attributes of the
input/text form, why?

Also, what class is params associated with?  I'd like to get into the
source a bit to get my answer, but I can even find my starting point.

The documentation for some of the details between view/controller with
CGI parameter passing is eluding me, though I have a 'rough' idea, I'd
like to know more.


This topic is locked and can not be replied to.