Not quite getting ajax to work

this might not be an ajax problem… but i am stumped…

to cut out all the mess, here’s what i have

a controller with this code:

def test
render(:layout => false)
@data = params[:newOpp]
end

a partial which contains a form that has a button like this:

<%= submit_to_remote(“confirm”,“Confirm Entry”, :url => {:action =>
‘test’}, :update => ‘confirmation’) %>

what i would like to do in test.rhtml is feed this info into another
partail… but i am getting the following problem…

when i try to access @data inside test.rhtml, i get NIL…

<%= @data.inspect %> #=> gives me NIL

but this:

<%= @params[:newOpp].inspect %> #=> gives me a dump of the form
params…

if i do this:

<% @data =params[:newOpp]%>

<%= @data.inspect %>

i get a dump of my data…

anyone have any idea what gives?

shouldn’t i be able do the assignment in the controller, and then just
access the variables in the view?

hopefully, i gave up enough info…

thanks!

sergio ruiz wrote:

def test
render(:layout => false)
@data = params[:newOpp]
end

what i would like to do in test.rhtml is feed this info into another
partail… but i am getting the following problem…

when i try to access @data inside test.rhtml, i get NIL…

I could be wrong, but I think your render(:layout=>false) is preventing
@data from getting to the view.

hth,
Bill

Hi –

On Thu, 13 Jul 2006, sergio ruiz wrote:

this might not be an ajax problem… but i am stumped…

to cut out all the mess, here’s what i have

a controller with this code:

def test
render(:layout => false)
@data = params[:newOpp]
end
[…]

Try switching the lines:

 @data = params[:newOpp]
 render(:layout => false)

David


http://www.rubypowerandlight.com => Ruby/Rails training & consultancy
Ruby for Rails => RUBY FOR RAILS (reviewed on
Slashdot, 7/12/2006!)
http://dablog.rubypal.com => D[avid ]A[. ]B[lack’s][ Web]log
[email protected] => me

Try switching the lines:

 @data = params[:newOpp]
 render(:layout => false)

that was exactly it!

now that i look at it, it totally makes sense…

thanks!