[Nitro] Request#params

Jonathan Buch john at oxyliquit.de
Mon Oct 1 08:38:24 EDT 2007


Hi,

> OgAdminController#save attempts to access request data via the 'request'
> method call:
>
> klass = name_to_class(*request*['object_class_name'].to_s)
> obj.assign(*request*, :assign_relations => true, :force_boolean => true)

yes, I believe that was always like that, as a shortcut to request.params.

> A couple problems
>
>   - Major misnomer: request returns a @context object

That I don't know about.

>   - @request does not have a [] method for accessing incoming request
> variables ( nor should it...)

Any reason why?

* request.params['foo']
* request['foo']

I use the second form all the time.

> I've worked around it for now by calling
> @context.post_params['object_class_name'] .... which led up to the
> question in my prev. email, since @context.params would be nicer...

I'm not sure I follow you here.  The parameters come from the "Request"
(requested by browser) and I'm not sure if 'context' better describes
where the parameters come from.  IMO they belong to the current
'request cycle' and not to a 'generic context'.  But mind you, that is
just generally, if Nitro returns a `Context` object when you call
`request` then that's just kind of an alias....

>>   31    def params
>>   32        return method == :post ? @post_params : @get_params
>>   33    end

I'm not sure about the contents of those, but IIRC the plan (quite a while
back) was to do a little more:

def params
   return method == :post ? @get_params.merge(@post_params) : @get_params
end

(Where I assume the @get_params is an hash.)

But that might now be obsolete when we have both .get/post_params  
available.

Carry on :P

Jo

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/


More information about the Nitro-general mailing list