I am getting a blank page, no errors, just a blank page. I have 2 files... reports/city_taxes_print.erb reports/_city_taxes_print.erb and my method is city_taxes_print and after getting variables from the controller, my erb file which is fairly basic... <% # City of Scottsdale @taxauthids = [ "32", "40" ] @report_title = "Scottsdale Sales Tax Detail Report for the Period Ending " + @period.lastdate_in_period.strftime("%m-%d-%Y") @taxes = Debtortranstaxes.find(:all, :conditions => ["trandate BETWEEN :begin AND :end AND taxauthid IN (:ids)", {:begin => @per1, :end => @per2, :ids => @taxauthids}], :joins => ''LEFT JOIN debtortrans ON debtortrans.id=debtortransid'', :include => ''debtortrans'', :select => ''debtorno, trandate, transno, ovamount, taxamount, taxauthid'', :order => ''trandate, transno'') render :partial => ''reports/city_taxes_print.erb'' %> but it only renders a blank page and there are quite a few things in _city_taxes_print.erb that should be rendering. development.log shows everything working as normal, code 200 (success), SQL query looks right. I am looking at the API for rails and I can''t see anything that has changed since 1.2.x that would make this not work for me. Can anyone suggest why I am getting a blank partial? Craig -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
2009/7/29 Craig White <craigwhite-BQ75lA0ptkhBDgjK7y7TUQ@public.gmane.org>:> > I am getting a blank page, no errors, just a blank page. > > I have 2 files... > reports/city_taxes_print.erb > reports/_city_taxes_print.erbWould not those normally be .html.erb?> > and my method is city_taxes_print and after getting variables from the > controller, my erb file which is fairly basic... > > <% # City of Scottsdale > @taxauthids = [ "32", "40" ] > @report_title = "Scottsdale Sales Tax Detail Report for the Period > Ending " + @period.lastdate_in_period.strftime("%m-%d-%Y") > @taxes = Debtortranstaxes.find(:all, :conditions => ["trandate > BETWEEN :begin AND :end AND taxauthid IN (:ids)", {:begin => @per1, :end > => @per2, :ids => @taxauthids}], > :joins => ''LEFT JOIN debtortrans ON debtortrans.id=debtortransid'', > :include => ''debtortrans'', > :select => ''debtorno, trandate, transno, ovamount, taxamount, > taxauthid'', > :order => ''trandate, transno'') > render :partial => ''reports/city_taxes_print.erb'' > %> >I think render :partial has to be inside <%= %> not <% %> Possibly not relevant to your problem but it is not usual to put code like the above in the view. It would generally go in the controller/model, with as much of the code as possible in the models. Colin> but it only renders a blank page and there are quite a few things in > _city_taxes_print.erb that should be rendering. > > development.log shows everything working as normal, code 200 (success), > SQL query looks right. > > I am looking at the API for rails and I can''t see anything that has > changed since 1.2.x that would make this not work for me. > > Can anyone suggest why I am getting a blank partial?
On Wed, 2009-07-29 at 21:55 +0100, Colin Law wrote:> 2009/7/29 Craig White <craigwhite-BQ75lA0ptkhBDgjK7y7TUQ@public.gmane.org>: > > > > I am getting a blank page, no errors, just a blank page. > > > > I have 2 files... > > reports/city_taxes_print.erb > > reports/_city_taxes_print.erb > > Would not those normally be .html.erb?---- probably...I tend to grasp at straws in desperation. They started out as html.erb files ----> > > > and my method is city_taxes_print and after getting variables from the > > controller, my erb file which is fairly basic... > > > > <% # City of Scottsdale > > @taxauthids = [ "32", "40" ] > > @report_title = "Scottsdale Sales Tax Detail Report for the Period > > Ending " + @period.lastdate_in_period.strftime("%m-%d-%Y") > > @taxes = Debtortranstaxes.find(:all, :conditions => ["trandate > > BETWEEN :begin AND :end AND taxauthid IN (:ids)", {:begin => @per1, :end > > => @per2, :ids => @taxauthids}], > > :joins => ''LEFT JOIN debtortrans ON debtortrans.id=debtortransid'', > > :include => ''debtortrans'', > > :select => ''debtorno, trandate, transno, ovamount, taxamount, > > taxauthid'', > > :order => ''trandate, transno'') > > render :partial => ''reports/city_taxes_print.erb'' > > %> > > > > I think render :partial has to be inside <%= %> not <% %> > > Possibly not relevant to your problem but it is not usual to put code > like the above in the view. It would generally go in the > controller/model, with as much of the code as possible in the models.---- yes, the = inside the <% was of course relevant and the solution...duh, thanks as for why I would put logic inside view file...this stems from things that I did successfully in 1.2.x that seemingly also do not work in 2.3.2 - perhaps I was taking advantage of undocumented ''features'', aka bugs. The concept is to have one ''method'' print several different pages with different criteria for each ''partial'' and using css div''s to ''page-break-after'' each one so that the result was multi-paged html. This actually worked for me in 1.2.x but I am only getting the last page in 2.3.2. ;-( The controller only allows a single ''render'' command per method. Craig -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=UTF-8" http-equiv="Content-Type"> <title></title> </head> <body bgcolor="#ffffff" text="#000000"> As I posted earlier, I want to count lines in a text area.<br> I use the following function<br> lines = texto.split(/\n/).size if texto !=nil<br> <br> But fails when one line of text "wraps" automatically to the next line so no "\n" mark is returned into the text.<br> <br> So i found the "wrap" attribute of textareas that works this way:<br> <ul> <li>soft</li> <li>hard</li> <li>off</li> </ul> <p><i>Soft</i> forces the words to wrap once inside the text area but when the form is submitted, the words will no longer appear as such (Line breaks will not be added).</p> <p><i>Hard</i> wraps the words inside the text box and places line breaks at the end of each line so that when the form is submitted it appears exactly as it does in the text box.</p> <p><i>Off</i> sets a textarea to ignore all wrapping and places the text into one ongoing line.</p> So I insert it in my txtarea definition like this:<br> <br> <%= f.text_area :texto, :cols => "30" , :style => "whiteSpace:pre-line;", :wrap => "hard" %><br> <br> <br> Nothig happens. The count line was the same.<br> Any suggestions ?<br> FF<br> <br> <br> --~--~---------~--~----~------------~-------~--~----~<br> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. <br> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <br> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <br> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en<br> -~----------~----~----~----~------~----~------~--~---<br> </body> </html> <br>
2009/7/30 Fabian <fabianfx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> As I posted earlier, I want to count lines in a text area. > I use the following function > lines = texto.split(/\n/).size if texto !=nil > > But fails when one line of text "wraps" automatically to the next line so no > "\n" mark is returned into the text. > > So i found the "wrap" attribute of textareas that works this way: > > soft > hard > off > > Soft forces the words to wrap once inside the text area but when the form is > submitted, the words will no longer appear as such (Line breaks will not be > added). > > Hard wraps the words inside the text box and places line breaks at the end > of each line so that when the form is submitted it appears exactly as it > does in the text box. > > Off sets a textarea to ignore all wrapping and places the text into one > ongoing line. > > So I insert it in my txtarea definition like this: > > <%= f.text_area :texto, :cols => "30" , :style => "whiteSpace:pre-line;", > :wrap => "hard" %> > > > Nothig happens. The count line was the same. > Any suggestions ?Have you checked the html generated (View, Page Source or similar in browser) to check the option has been coded correctly? Colin
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=UTF-8" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> HTML generated is:<br> <span role="treeitem" class="nodeLabelBox repTarget"><<span class="nodeTag">textarea</span><span class="nodeAttr editGroup"> <span class="nodeName editable">id</span>="<span class="nodeValue editable">aviso_texto</span>"</span><span class="nodeAttr editGroup"> <span class="nodeName editable">wrap</span>="<span class="nodeValue editable">hard</span>"</span><span class="nodeAttr editGroup"> <span class="nodeName editable">style</span>="<span class="nodeValue editable"></span>"</span><span class="nodeAttr editGroup"> <span class="nodeName editable">rows</span>="<span class="nodeValue editable">20</span>"</span><span class="nodeAttr editGroup"> <span class="nodeName editable">name</span>="<span class="nodeValue editable">aviso[texto]</span>"</span><span class="nodeAttr editGroup"> <span class="nodeName editable">cols</span>="<span class="nodeValue editable">30</span>"</span><span class="nodeBracket editable insertBefore">/><br> <br> </span></span>Colin Law escribió: <blockquote cite="mid:5fbc01370907301430k586a3d7t6f096954160dd6c5-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org" type="cite"> <pre wrap="">2009/7/30 Fabian <a class="moz-txt-link-rfc2396E" href="mailto:fabianfx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org"><fabianfx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org></a>: </pre> <blockquote type="cite"> <pre wrap="">As I posted earlier, I want to count lines in a text area. I use the following function lines = texto.split(/\n/).size if texto !=nil But fails when one line of text "wraps" automatically to the next line so no "\n" mark is returned into the text. So i found the "wrap" attribute of textareas that works this way: soft hard off Soft forces the words to wrap once inside the text area but when the form is submitted, the words will no longer appear as such (Line breaks will not be added). Hard wraps the words inside the text box and places line breaks at the end of each line so that when the form is submitted it appears exactly as it does in the text box. Off sets a textarea to ignore all wrapping and places the text into one ongoing line. So I insert it in my txtarea definition like this: <%= f.text_area :texto, :cols => "30" , :style => "whiteSpace:pre-line;", :wrap => "hard" %> Nothig happens. The count line was the same. Any suggestions ? </pre> </blockquote> <pre wrap=""><!----> Have you checked the html generated (View, Page Source or similar in browser) to check the option has been coded correctly? Colin </pre> </blockquote> <br> <br> --~--~---------~--~----~------------~-------~--~----~<br> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. <br> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <br> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <br> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en<br> -~----------~----~----~----~------~----~------~--~---<br> </body> </html> <br>
2009/7/31 Fabian <fabianfx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> HTML generated is: > <textarea id="aviso_texto" wrap="hard" style="" rows="20" name="aviso[texto]" cols="30"/> >That looks ok, have you looked in the log (log/development.log) to see what is actually submitted? Colin> Colin Law escribió: > > 2009/7/30 Fabian <fabianfx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > > > As I posted earlier, I want to count lines in a text area. > I use the following function > lines = texto.split(/\n/).size if texto !=nil > > But fails when one line of text "wraps" automatically to the next line so no > "\n" mark is returned into the text. > > So i found the "wrap" attribute of textareas that works this way: > > soft > hard > off > > Soft forces the words to wrap once inside the text area but when the form is > submitted, the words will no longer appear as such (Line breaks will not be > added). > > Hard wraps the words inside the text box and places line breaks at the end > of each line so that when the form is submitted it appears exactly as it > does in the text box. > > Off sets a textarea to ignore all wrapping and places the text into one > ongoing line. > > So I insert it in my txtarea definition like this: > > <%= f.text_area :texto, :cols => "30" , :style => "whiteSpace:pre-line;", > :wrap => "hard" %> > > > Nothig happens. The count line was the same. > Any suggestions ? > > > Have you checked the html generated (View, Page Source or similar in > browser) to check the option has been coded correctly? > > Colin > > > > > > > >
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=UTF-8" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> Colin:<br> Nothing for this field in the development.log<br> Do I set anythig special to log the template ?<br> FF<br> Colin Law escribió: <blockquote cite="mid:5fbc01370907311317g6fd2c061yd1cfee2cd316ed37-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org" type="cite"> <pre wrap="">2009/7/31 Fabian <a class="moz-txt-link-rfc2396E" href="mailto:fabianfx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org"><fabianfx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org></a>: </pre> <blockquote type="cite"> <pre wrap="">HTML generated is: <textarea id="aviso_texto" wrap="hard" style="" rows="20" name="aviso[texto]" cols="30"/> </pre> </blockquote> <pre wrap=""><!----> That looks ok, have you looked in the log (log/development.log) to see what is actually submitted? Colin </pre> <blockquote type="cite"> <pre wrap="">Colin Law escribió: 2009/7/30 Fabian <a class="moz-txt-link-rfc2396E" href="mailto:fabianfx@gmail.com"><fabianfx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org></a>: As I posted earlier, I want to count lines in a text area. I use the following function lines = texto.split(/\n/).size if texto !=nil But fails when one line of text "wraps" automatically to the next line so no "\n" mark is returned into the text. So i found the "wrap" attribute of textareas that works this way: soft hard off Soft forces the words to wrap once inside the text area but when the form is submitted, the words will no longer appear as such (Line breaks will not be added). Hard wraps the words inside the text box and places line breaks at the end of each line so that when the form is submitted it appears exactly as it does in the text box. Off sets a textarea to ignore all wrapping and places the text into one ongoing line. So I insert it in my txtarea definition like this: <%= f.text_area :texto, :cols => "30" , :style => "whiteSpace:pre-line;", :wrap => "hard" %> Nothig happens. The count line was the same. Any suggestions ? Have you checked the html generated (View, Page Source or similar in browser) to check the option has been coded correctly? Colin </pre> </blockquote> <pre wrap=""><!----> </pre> </blockquote> <br> <br> --~--~---------~--~----~------------~-------~--~----~<br> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. <br> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <br> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <br> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en<br> -~----------~----~----~----~------~----~------~--~---<br> </body> </html> <br>
2009/7/31 Fabian <fabianfx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> Colin: > Nothing for this field in the development.log > Do I set anythig special to log the template ? >In the log you should see something along the lines of this, but with the data from your form in it. This is extracted from my log. Processing NotesController#create (for 127.0.0.1 at 2009-06-12 17:00:57) [POST] Parameters: {"commit"=>"Create", "note"=>{"date(1i)"=>"2009", "date(2i)"=>"6", "date(3i)"=>"12", "max_present"=>"", "text"=>"Some text", "obj_ids"=>["47", "85"], "location_id"=>"23", "is_present"=>"1"}} You are still top posting by the way. Colin> Colin Law escribió: > > 2009/7/31 Fabian <fabianfx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > > > HTML generated is: > <textarea id="aviso_texto" wrap="hard" style="" rows="20" name="aviso[texto]" cols="30"/> > > > > That looks ok, have you looked in the log (log/development.log) to see > what is actually submitted? > > Colin > > > > Colin Law escribió: > > 2009/7/30 Fabian <fabianfx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > > > As I posted earlier, I want to count lines in a text area. > I use the following function > lines = texto.split(/\n/).size if texto !=nil > > But fails when one line of text "wraps" automatically to the next line so no > "\n" mark is returned into the text. > > So i found the "wrap" attribute of textareas that works this way: > > soft > hard > off > > Soft forces the words to wrap once inside the text area but when the form is > submitted, the words will no longer appear as such (Line breaks will not be > added). > > Hard wraps the words inside the text box and places line breaks at the end > of each line so that when the form is submitted it appears exactly as it > does in the text box. > > Off sets a textarea to ignore all wrapping and places the text into one > ongoing line. > > So I insert it in my txtarea definition like this: > > <%= f.text_area :texto, :cols => "30" , :style => "whiteSpace:pre-line;", > :wrap => "hard" %> > > > Nothig happens. The count line was the same. > Any suggestions ? > > > Have you checked the html generated (View, Page Source or similar in > browser) to check the option has been coded correctly? > > Colin > > > > > > > > > > > >
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=UTF-8" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> I saw inside the firebug. <br> The value of the field ("texto") is :<br> <br> " example line 1 \r\n line 2 without enter \n line 3 with enter"<br> <br> So I conclude that the "wrapped" lines return with "\r\n" mark. <br> No problem but my original function splits by "\n" mark:<br> <pre wrap="">lines = texto.split(/\n/).size if texto !=nil But Oooooppppssss the result is again 2. Split function only work with "\n" mark alone. Do not when then "\n" mark have a folk mark "\r" by it side ? </pre> <br> I am preparing to kill "\r" marks.....(only inside the "texto" field...)<br> <pre wrap="">Another suggestion ? </pre> <br> Colin Law escribió: <blockquote cite="mid:5fbc01370907311346x5490253atfc17393f3cc6ad51-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org" type="cite"> <pre wrap="">2009/7/31 Fabian <a class="moz-txt-link-rfc2396E" href="mailto:fabianfx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org"><fabianfx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org></a>: </pre> <blockquote type="cite"> <pre wrap="">Colin: Nothing for this field in the development.log Do I set anythig special to log the template ? </pre> </blockquote> <pre wrap=""><!----> In the log you should see something along the lines of this, but with the data from your form in it. This is extracted from my log. Processing NotesController#create (for 127.0.0.1 at 2009-06-12 17:00:57) [POST] Parameters: {"commit"=>"Create", "note"=>{"date(1i)"=>"2009", "date(2i)"=>"6", "date(3i)"=>"12", "max_present"=>"", "text"=>"Some text", "obj_ids"=>["47", "85"], "location_id"=>"23", "is_present"=>"1"}} You are still top posting by the way. Colin </pre> <blockquote type="cite"> <pre wrap="">Colin Law escribió: 2009/7/31 Fabian <a class="moz-txt-link-rfc2396E" href="mailto:fabianfx@gmail.com"><fabianfx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org></a>: HTML generated is: <textarea id="aviso_texto" wrap="hard" style="" rows="20" name="aviso[texto]" cols="30"/> That looks ok, have you looked in the log (log/development.log) to see what is actually submitted? Colin Colin Law escribió: 2009/7/30 Fabian <a class="moz-txt-link-rfc2396E" href="mailto:fabianfx@gmail.com"><fabianfx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org></a>: As I posted earlier, I want to count lines in a text area. I use the following function lines = texto.split(/\n/).size if texto !=nil But fails when one line of text "wraps" automatically to the next line so no "\n" mark is returned into the text. So i found the "wrap" attribute of textareas that works this way: soft hard off Soft forces the words to wrap once inside the text area but when the form is submitted, the words will no longer appear as such (Line breaks will not be added). Hard wraps the words inside the text box and places line breaks at the end of each line so that when the form is submitted it appears exactly as it does in the text box. Off sets a textarea to ignore all wrapping and places the text into one ongoing line. So I insert it in my txtarea definition like this: <%= f.text_area :texto, :cols => "30" , :style => "whiteSpace:pre-line;", :wrap => "hard" %> Nothig happens. The count line was the same. Any suggestions ? Have you checked the html generated (View, Page Source or similar in browser) to check the option has been coded correctly? Colin </pre> </blockquote> <pre wrap=""><!----> </pre> </blockquote> <br> <br> --~--~---------~--~----~------------~-------~--~----~<br> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. <br> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <br> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <br> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en<br> -~----------~----~----~----~------~----~------~--~---<br> </body> </html> <br>