Aldric Giacomoni
2010-Jan-07 20:52 UTC
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? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
tommy xiao
2010-Jan-08 05:11 UTC
Re: Rendering partial from button click, not passing locals ?
best choice is ajax 2010/1/8 Aldric Giacomoni <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>> 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? > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > > >-- tommy xiao E-mail: xiaods(AT)gmail.com -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Curtis Schofield
2010-Jan-08 05:27 UTC
Re: Rendering partial from button click, not passing locals ?
don''t you need to specify %p== #{rows} updated ?? On Thu, Jan 7, 2010 at 1:52 PM, Aldric Giacomoni <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:> 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? > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Aldric Giacomoni
2010-Jan-08 14:30 UTC
Re: Rendering partial from button click, not passing locals ?
Curtis Schofield 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. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Aldric Giacomoni
2010-Jan-08 16:25 UTC
Re: Rendering partial from button click, not passing locals ?
Aldric Giacomoni wrote:> Curtis Schofield 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... -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Curtis Schofield
2010-Jan-08 17:58 UTC
Re: Re: Rendering partial from button click, not passing locals ?
On Fri, Jan 8, 2010 at 9:25 AM, Aldric Giacomoni <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:> Aldric Giacomoni wrote: > > Curtis Schofield 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... > > 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. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.