[Nitro] Request#params
Robert Mela
rob at robmela.com
Mon Oct 1 08:41:13 EDT 2007
Whoa.. I should proofread...
"@request does not have a [] method" should read "@context does not have..."
Robert Mela wrote:
> A second, related question --
>
> 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)
>
> A couple problems
>
> - Major misnomer: request returns a @context object
> - @request does not have a [] method for accessing incoming request
> variables ( nor should it...)
>
> 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...
>
>
>
>
>
> Robert Mela wrote:
>> Not sure what the intent is here in request.rb, module Raw, included
>> in class Context
>>
>> 31 def params
>> 32 if method == :post
>> 33 @post_params.instance_variable_get("@hash")
>> 34 else
>> 35 @get_params.instance_variable_get("@hash")
>> 36 end
>> 37 end
>>
>>
>> @post_params is itself a hash and an instance variable on Context,
>> and @post_params.instance_variable_get( "@hash" ) returns nil.
>>
>> Anything wrong with doing this instead?
>>
>> 31 def params
>> 32 return method == :post ? @post_params : @get_params
>> 33 end
>>
>> If that's acceptable I'll add it to the patches I'm preparing.
>>
>> thx.
>> _______________________________________________
>> Nitro-general mailing list
>> Nitro-general at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/nitro-general
>
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rob.vcf
Type: text/x-vcard
Size: 116 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/nitro-general/attachments/20071001/05976721/attachment.vcf
More information about the Nitro-general
mailing list