Rendering partial from button click, not passing locals?

I wrote the relevant code in this pastie:
http://pastie.org/770642
(it’s not too much code – but it looks a ton better than black on
white!)

And here is the bit from my log:

Processing UltrasoundsController#index (for 127.0.0.1 at 2010-01-07
10:32:03) [GET]
Rendering template within layouts/application
Rendering ultrasounds/index
Completed in 172ms (View: 16, DB: 105044) | 200 OK
[http://localhost/ultrasounds]

Processing UltrasoundsController#fix_ultrasounds (for 127.0.0.1 at
2010-01-07 10:32:05) [POST]
Parameters:
{“authenticity_token”=>“I7ucDb3iTXMpaFeRdCjTGtu6qFSgSq92VBCKg4SIcFA=”}
Completed in 532ms (View: 0, DB: 0) | 200 OK
[http://localhost/ultrasounds/fix_ultrasounds]

Do you know why “rows” doesn’t get passed, like I would expect it to?

best choice is ajax

2010/1/8 Aldric G. [email protected]

don’t you need to specify
%p== #{rows} updated

??

Curtis S. wrote:

don’t you need to specify
%p== #{rows} updated

??

According to the HAML reference:
http://haml-lang.com/docs/yardoc/file.HAML_REFERENCE.html#ruby_interpolation_

%p This is #{h quality} cake!

This should work. So I was missing the ‘h’, which I added:
%p #{h rows} updated.

But … No cigar.

On Fri, Jan 8, 2010 at 9:25 AM, Aldric G.
[email protected]wrote:

%p There were #{h rows} updated.
sounds like a good place to start with a test (results.size.should == 1)
good luck - ‘ruby-debug’ is on of my favorite tools for stuff like this.

Aldric G. wrote:

Curtis S. wrote:

don’t you need to specify
%p== #{rows} updated

??

I tried these:
%p #{h rows} updated.
%p= "There were #{h rows} updated.
%p There were #{h rows} updated.
%p== There were #{h rows} updated.

I always got a “0” where “rows” was interpolated. So … Either the
variable isn’t passed correctly, or it is, and the result is zero.

Well, I tried to run one of the update queries using the run_query
method in irb, and got a result of 5… Which surprised me because the
result should have been one. So there’s probably a few things going on
here…