Verify hash key in hash in params hash

Hi,

how can I use Rails ActionController::Verification#verify :params when
the hash key is in a hash?
E.g.: params[:form][:textfield] and I want to verify that :textfield is
a key in params[:form]

Thanks
Markus

Markus K. wrote on 09.07.2006 20:54:

Hi,

how can I use Rails ActionController::Verification#verify :params when
the hash key is in a hash?
E.g.: params[:form][:textfield] and I want to verify that :textfield is
a key in params[:form]

Don’t you know this or isn’t it possible?

Markus K. wrote:

Hi,

how can I use Rails ActionController::Verification#verify :params when
the hash key is in a hash?
E.g.: params[:form][:textfield] and I want to verify that :textfield is
a key in params[:form]

Thanks
Markus

Hi,
Howabout
if params[:form][:textfield]
That should do it.

Chris C. wrote on 10.07.2006 16:05:

Hi,
Howabout
if params[:form][:textfield]
That should do it.

I want to use ActionController::Verification#verify.

#verify :params => :form checks if params has a key :form or generates
an error page.
So #verify checks in the keys of params.
Now I want that #verify checks a “subkey” of a key of params hash.

So it should be something like this which doesn’t work…
params.has_key? :form[:textfield]
NoMethodError: undefined method `[]’ for :form:Symbol

It must be relative to hash params because #verify checks params.

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