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 Kolb 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 Kolb 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 > MarkusHi, Howabout if params[:form][:textfield] That should do it. -- Posted via http://www.ruby-forum.com/.
Chris Carter wrote on 10.07.2006 16:05:> Markus Kolb 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.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.