Christophe Porteneuve wrote:
> Mark Reginald James a écrit :
>>    :with => 'js_variable'
>>
>> which Rails turns into a Prototype Ajax call with option
>>
>>    parameter: js_variable
> 
> Actually, what Rails does with this is define the name of the HTTP
> request parameter that will be used for sending the recently-changed
> value of the field/form you're observing.

Thank you Christophe for your reply.

To significantly save on duplication, I've factored out my erb
remote_function calls from a large number of triggering document
links into a page-wide javascript function.  In this context the
js variable I wish to send remotely is not the "value" that the
Rails helper expects (though I could certainly rename to make it so).

So in this context I can't write

   :with => 'param_key'

to make params[:param_key] available in my controller, because this
will try to send the non-existent value variable. I instead have to
write

   :with =>'"param_key="+js_variable'

In contrast,

   :with => 'js_variable'

works in conjunction with request.raw_post.


>> and which can be retrieved in the controller as request.raw_post,
> 
> Why on Earth wouldn't you use @params[:js_variable]?!

Because it's much easier to type the shorter :with option.


>> does not work in the current SVN prototype because an equals
>> sign is appended to the post string.
> 
> Of course it is, as per docs, specs, and common sense.  There should
> also be the field's VALUE sent there, right after the '=' sign.  If the
> value is empty at the time, of course there won't be anything.
> 
>> Should I submit a patch to Prototype's toQueryString function,
> 
> .toQueryString() is perfectly fine, especially on SVN.

I'm just saying (and warning) that what once worked now doesn't,
and was asking whether my usage was a quirk that just happened to
work, or whether the breakage was unintentional and a patch is
in order.


> What exactly are you trying to do?  You sound like you just don't use
> :with properly.  Can you provide us with some context here?

See above.


-- 
We develop, watch us RoR, in numbers too big to ignore.


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to