Jon Druse
2007-Nov-05 17:04 UTC
Can someone please help me? I think i''m going crazy! [bug]
hello all.. i''m experiencing what seems to be a bug in rails while trying to pass a local variable to a partial. i''m referencing code from : http://www.pointstorm.com/~gavin/partials-doc/classes/ActionView/Partials.html here''s my code View: ----------- <%= render_partial ''report_form'', nil, ''r'' => ''1'' %> ----------- i''ve tried the ''1'' with and without quotes.... Partial: ----------- <label>Criteria <%= r %></label> <%= text_field "report", "phrase#{r}", :size => 20 %> <%= link_to "Add Criteria", :action => "report_builder", :id => r.to_i+1 %> ----------- and here''s the error i''m getting: ---------- compile error script/../config/../app/views/assets/_report_form.rhtml:-1: syntax error, unexpected ''='', expecting kEND = local_assigns[:] ^ script/../config/../app/views/assets/_report_form.rhtml:-1: syntax error, unexpected '']'', expecting tSTRING_CONTENT or tSTRING_DBEG or tSTRING_DVAR or tSTRING_END Extracted source (around line #10): 7: 8: <%= link_to "Add Criteria", :action => "report_builder", :id => r.to_i+1 %> --------- this isn''t making any sense to me. as you can see the partial is only 8 lines... not 10. i''m used to getting errors on lines that aren''t there when i forget to put and ''end'' tag somewhere.. but that''s not the problem here. can anyone tell me what i''m doing wrong. maybe i''m just too tired. :-) Jon -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
William Pratt
2007-Nov-05 17:10 UTC
Re: Can someone please help me? I think i''m going crazy! [bug]
Try this: <%= render :partial => ''report_form'', :locals => { :r => 1} %> -Bill Jon Druse wrote:> hello all.. > > i''m experiencing what seems to be a bug in rails while trying to pass a > local variable to a partial. i''m referencing code from : > > http://www.pointstorm.com/~gavin/partials-doc/classes/ActionView/Partials.html > > > here''s my code > > View: > > ----------- > > <%= render_partial ''report_form'', nil, ''r'' => ''1'' %> > > ----------- > > i''ve tried the ''1'' with and without quotes.... > > > Partial: > > ----------- > > <label>Criteria <%= r %></label> > > > <%= text_field "report", "phrase#{r}", :size => 20 %> > > <%= link_to "Add Criteria", :action => "report_builder", :id => r.to_i+1 > %> > > > ----------- > > and here''s the error i''m getting: > > > ---------- > > > > compile error > script/../config/../app/views/assets/_report_form.rhtml:-1: syntax > error, unexpected ''='', expecting kEND > = local_assigns[:] > ^ > script/../config/../app/views/assets/_report_form.rhtml:-1: syntax > error, unexpected '']'', expecting tSTRING_CONTENT or tSTRING_DBEG or > tSTRING_DVAR or tSTRING_END > > Extracted source (around line #10): > > 7: > 8: <%= link_to "Add Criteria", :action => "report_builder", :id => > r.to_i+1 %> > > > --------- > > > this isn''t making any sense to me. as you can see the partial is only 8 > lines... not 10. i''m used to getting errors on lines that aren''t there > when i forget to put and ''end'' tag somewhere.. but that''s not the > problem here. can anyone tell me what i''m doing wrong. maybe i''m just > too tired. :-) > > Jon >-- Sincerely, William Pratt --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jon Druse
2007-Nov-05 17:15 UTC
Re: Can someone please help me? I think i''m going crazy! [bu
> Try this: > > <%= render :partial => ''report_form'', :locals => { :r => 1} %> > > -Billthanks for the suggestion.. it didn''t work. do you think it might be a bug? it seems that nothing works. even if my partial is completely empty, it still throws an error. :-( -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2007-Nov-05 17:16 UTC
Re: Can someone please help me? I think i''m going crazy! [bug]
On 5 Nov 2007, at 17:04, Jon Druse wrote:> > hello all.. > > i''m experiencing what seems to be a bug in rails while trying to > pass a > local variable to a partial. i''m referencing code from : > > http://www.pointstorm.com/~gavin/partials-doc/classes/ActionView/Partials.html > > > here''s my code > > View: > > ----------- > > <%= render_partial ''report_form'', nil, ''r'' => ''1'' %> >render_partial is deprecated. does render :partial => ''report_form'', :locals => {''r'' => ''1} work any better ? Fred --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
William Pratt
2007-Nov-05 17:17 UTC
Re: Can someone please help me? I think i''m going crazy! [bu
Can you paste in the error you are getting when trying my suggestion? I use this in many places with no issues. -Bill Jon Druse wrote:> >> Try this: >> >> <%= render :partial => ''report_form'', :locals => { :r => 1} %> >> >> -Bill >> > > > thanks for the suggestion.. it didn''t work. do you think it might be a > bug? it seems that nothing works. even if my partial is completely > empty, it still throws an error. :-( >-- Sincerely, William Pratt --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jon Druse
2007-Nov-05 17:20 UTC
Re: Can someone please help me? I think i''m going crazy! [bu
William Pratt wrote:> Can you paste in the error you are getting when trying my suggestion? I > use this in many places with no issues. > > -Billcompile error script/../config/../app/views/assets/_report_form.rhtml:-2: syntax error, unexpected ''='', expecting kEND = local_assigns[:] ^ script/../config/../app/views/assets/_report_form.rhtml:-2: syntax error, unexpected '']'', expecting tSTRING_CONTENT or tSTRING_DBEG or tSTRING_DVAR or tSTRING_END this error isn''t making any sense to me. thanks for your help.. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jon Druse
2007-Nov-05 17:27 UTC
Re: Can someone please help me? I think i''m going crazy! [bu
> this error isn''t making any sense to me. thanks for your help..ok i fixed it but you''ll never guess how... my partial was named _report_form.rhtml.. when i changed it to _reportform.rhtml.. now it works! should this be reported somewhere? i''ve never heard that you can have underscores in the partial name. let me know what you guys think. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
William Pratt
2007-Nov-05 17:27 UTC
Re: Can someone please help me? I think i''m going crazy! [bu
That appears to be the error from the browser. What is in your logs? I suspect there is more info waiting in development.log that will help you on this. -Bill Jon Druse wrote:> William Pratt wrote: > >> Can you paste in the error you are getting when trying my suggestion? I >> use this in many places with no issues. >> >> -Bill >> > > > compile error > script/../config/../app/views/assets/_report_form.rhtml:-2: syntax > error, unexpected ''='', expecting kEND > = local_assigns[:] > ^ > script/../config/../app/views/assets/_report_form.rhtml:-2: syntax > error, unexpected '']'', expecting tSTRING_CONTENT or tSTRING_DBEG or > tSTRING_DVAR or tSTRING_END > > > this error isn''t making any sense to me. thanks for your help.. >-- Sincerely, William Pratt --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
William Pratt
2007-Nov-05 17:29 UTC
Re: Can someone please help me? I think i''m going crazy! [bu
No, there is something else going on here. I use underscores in many partial names. -Bill Jon Druse wrote:> >> this error isn''t making any sense to me. thanks for your help.. >> > > ok i fixed it but you''ll never guess how... my partial was named > _report_form.rhtml.. when i changed it to _reportform.rhtml.. now it > works! should this be reported somewhere? i''ve never heard that you > can have underscores in the partial name. let me know what you guys > think. >-- Sincerely, William Pratt --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Mohit Sindhwani
2007-Nov-05 17:30 UTC
Re: Can someone please help me? I think i''m going crazy! [bu
Jon Druse wrote:> >> this error isn''t making any sense to me. thanks for your help.. >> > > ok i fixed it but you''ll never guess how... my partial was named > _report_form.rhtml.. when i changed it to _reportform.rhtml.. now it > works! should this be reported somewhere? i''ve never heard that you > can have underscores in the partial name. let me know what you guys > think. >I''ve used partials like _list_header.rhtml in the past, so it seems a bit odd to see what you say. I haven''t followed your thread so far but how are you calling it from your view code? Cheers Mohit. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jon Druse
2007-Nov-05 17:46 UTC
Re: Can someone please help me? I think i''m going crazy! [bu
Mohit Sindhwani wrote:> > I''ve used partials like _list_header.rhtml in the past, so it seems a > bit odd to see what you say. I haven''t followed your thread so far but > how are you calling it from your view code? > > Cheers > Mohit.View : ------------- <%= render :partial => ''reportform'', :locals => { :r => 1} %> ------------- i have also used underscores in my partials. maybe it''s because of the local variable assignment? i''m mostly dumbfounded by this. thanks again for your time. :-) jon -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Mohit Sindhwani
2007-Nov-05 17:49 UTC
Re: Can someone please help me? I think i''m going crazy! [bu
Jon Druse wrote:> Mohit Sindhwani wrote: > >> I''ve used partials like _list_header.rhtml in the past, so it seems a >> bit odd to see what you say. I haven''t followed your thread so far but >> how are you calling it from your view code? >> >> Cheers >> Mohit. >> > > > View : > > ------------- > > <%= render :partial => ''reportform'', :locals => { :r => 1} %> > > ------------- > > >Jon, I think that should be: <%= render :partial => ''report_form'', :locals => { :r => 1} %> (note the underscore after report) Rails won''t insert too many extra underscores for you ;-) Cheers, Mohit. 11/6/2007 | 1:49 AM.> i have also used underscores in my partials. maybe it''s because of the > local variable assignment? i''m mostly dumbfounded by this. thanks > again for your time. :-) jon >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jon Druse
2007-Nov-05 17:52 UTC
Re: Can someone please help me? I think i''m going crazy! [bu
> > <%= render :partial => ''report_form'', :locals => { :r => 1} %> > > (note the underscore after report)i changed the partial name to ''reportform.rhtml'', that''s how i got it to work :-) we were just trying to find out why it didn''t work before, when i did have the underscore in there. man this is getting confusing. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Mohit Sindhwani
2007-Nov-05 17:56 UTC
Re: Can someone please help me? I think i''m going crazy! [bu
Jon Druse wrote:> >> <%= render :partial => ''report_form'', :locals => { :r => 1} %> >> >> (note the underscore after report) >> > > i changed the partial name to ''reportform.rhtml'', that''s how i got it to > work :-) we were just trying to find out why it didn''t work before, > when i did have the underscore in there. man this is getting confusing. > >Like I said, I missed the earlier part of the thread but this is what the rules are (which I think you know): :partial => ''report_form'' ---> partial called _report_form.rhtml :partial => ''reportform'' ---> partial called _reportform.rhtml I guess somewhere in the debugging you did, an extra underscore got added or one got removed, and the 2 were not consistent any longer :) Cheers, Mohit. 11/6/2007 | 1:56 AM. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
William Pratt
2007-Nov-05 18:22 UTC
Re: Can someone please help me? I think i''m going crazy! [bu
Actually, can I see the reportform.rhtml view? I think that is where the error is coming from. Did you look at development.log to get the full error and stack trace? If you paste that in, it would be a huge help. -Bill Jon Druse wrote:> Mohit Sindhwani wrote: > >> I''ve used partials like _list_header.rhtml in the past, so it seems a >> bit odd to see what you say. I haven''t followed your thread so far but >> how are you calling it from your view code? >> >> Cheers >> Mohit. >> > > > View : > > ------------- > > <%= render :partial => ''reportform'', :locals => { :r => 1} %> > > ------------- > > > i have also used underscores in my partials. maybe it''s because of the > local variable assignment? i''m mostly dumbfounded by this. thanks > again for your time. :-) jon >-- Sincerely, William Pratt --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---