Stupid newbie question


#1

Here’s a request string which has a value I want to pull out from the
category array - parent_id.

Parameters: {“category”=>{“name”=>“Condiments”, “parent_id”=>“1”},
“commit”=>“Create”}

How do I reference that subelement in the receiving script? I’ve tried

params[:parent_id]
params[:category[:parent_id]]

both unsuccessfully. I told you this was a stupid question. So how do
I
get at those values?

Mike


#2

I’d try:

params[:category][:parent_id]

Mike Mannakee wrote:

Here’s a request string which has a value I want to pull out from the
category array - parent_id.

Parameters: {“category”=>{“name”=>“Condiments”, “parent_id”=>“1”},
“commit”=>“Create”}

How do I reference that subelement in the receiving script? I’ve tried

params[:parent_id]
params[:category[:parent_id]]

both unsuccessfully. I told you this was a stupid question. So how do
I
get at those values?

Mike


#3

Hi Mike,

You were close :wink: It’s params[:category][:parent_id]

It’s a hash of hashes.

Best regards,
Bill

----- Original Message -----
From: “Mike Mannakee” removed_email_address@domain.invalid
To: removed_email_address@domain.invalid
Sent: Sunday, May 07, 2006 6:49 PM
Subject: [Rails] Stupid newbie question