No request.raw_post when using RJS template?

Hi all

I wanted to try out the RJS thing for updating more than just one HTML
element using AJAX.

I have a selection like that:


Danc!ng TortoYse
DJ Psyhigh
DJ Yanniv Gold

I observate it using the following observator:

<%= observe_field(:booking_musician_profile_id,
:url => { :action => :update_new_form }) %>

Now I have a question: why is there now request.raw_post available? It’s
just empty, but I’d like it to store the ID of my selected option!
Also params only includes the :controller and :action values…

I don’t get it, why is it missing? Everything works fine: the update and
stuff is being made, my update_new_form.rjs does its action - but
without the wanted ID I can’t do what I want to do!

Anyone knows the solution? Thanks a lot.
Joshua

Hi Joshua,

Joshua M. wrote:

<%= observe_field(:booking_musician_profile_id,
:url => { :action => :update_new_form }) %>

I’d like it to store the ID of my selected option!
Also params only includes the :controller and :action values…

The easiest way to do pass back the value is to use the (very poorly
documented) ‘:with’ option. In your case:
<%= observe_field(:booking_musician_profile_id,
:url => { :action => :update_new_form }
:with => ‘player_id’ ) %>

In this example, in your controller, params[:player_id] will hold the
value
you’re looking for. You could call it anything you want in the :with
assignment. It just specifies what you’re going to name the key in the
params hash.

hth,
Bill

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