Using Rails 3.1.1 and trying to switch over to Ruby 1.9.3-p125 (I''ve got 1.9.3-p125 running via NGINx and 1.8.7 running via webrick so I can side by side). I''ve got the following in my ''host'' model (activeldap but I don''t that matters) def hostipnumbers_columnized if self.ipHostNumber == nil then results = [] else results = self.ipHostNumber.to_a.sort {|a,b| a <=> b }.collect { |ipnumber| ipnumber + "\n" } end return results end # Note: had to add ''.to_a'' to the method because sort is no longer a string option and in 1.8.7 when only 1 ipHostNumber is returned, it''s just a simple string but ruby 1.8.7 never complained but ruby 1.9.3 comes to a screeching halt Anyway, in my view, I''ve got... <%= text_area ''host'', ''hostipnumbers_columnized'', :cols => ''30'', :rows => ''8'' %> which when running on 1.8.7 was never an issue. Each ip address was put onto a new line because of the ''\n'' like this: 10.200.0.100 208.100.300.100 but when running on 1.9.3-p125 the text_area shows the array with all of it''s raw markup like this: ["10.200.0.100\n", "208.100.300.100\n"] I''ve done various things such as flattening, joining, etc. the hostipnumbers_columnized but it appears impossible to get them to display on individual lines in ruby-1.9.3 - without even considering code that will work equally as well with 1.8.7 Any suggestions? -- Craig White ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ craig.white-wmL3h9Ogt9DQT0dZR+AlfA@public.gmane.org 1.800.869.6908 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ www.ttiassessments.com Need help communicating between generations at work to achieve your desired success? Let us help! -- 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.
On Tue, Mar 6, 2012 at 13:41, Craig White <craig.white-wmL3h9Ogt9DQT0dZR+AlfA@public.gmane.org> wrote:> Each ip address was put onto a new line because of the ''\n'' like this: > 10.200.0.100 > 208.100.300.100 > > but when running on 1.9.3-p125 the text_area shows the array > with all of it''s raw markup like this: > ["10.200.0.100\n", "208.100.300.100\n"] > > I''ve done various things such as flattening, joining, etc. the > hostipnumbers_columnized but it appears impossible to get them to > display on individual lines in ruby-1.9.3 - without even considering > code that will work equally as well with 1.8.7 > > Any suggestions?join() seems to work fine for making the string suitable: $ irb ruby-1.9.3-head :001 > x = ["10.200.0.100\n", "208.100.300.100\n"] => ["10.200.0.100\n", "208.100.300.100\n"] ruby-1.9.3-head :002 > x.join => "10.200.0.100\n208.100.300.100\n" ruby-1.9.3-head :003 > puts x.join 10.200.0.100 208.100.300.100 => nil ruby-1.9.3-head :004 > ^D Would it cause problems elsewhere if hostipnumbers_columnized were to return results.join? What do you get in the text_area if you do that? -Dave -- Dave Aronson: Available Cleared Ruby on Rails Freelancer (NoVa/DC/Remote) -- see www.DaveAronson.com, and blogs at www.Codosaur.us, www.Dare2XL.com, www.RecruitingRants.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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Mar 6, 2012, at 12:23 PM, Dave Aronson wrote:> On Tue, Mar 6, 2012 at 13:41, Craig White <craig.white-wmL3h9Ogt9DQT0dZR+AlfA@public.gmane.org> wrote: > >> Each ip address was put onto a new line because of the ''\n'' like this: >> 10.200.0.100 >> 208.100.300.100 >> >> but when running on 1.9.3-p125 the text_area shows the array >> with all of it''s raw markup like this: >> ["10.200.0.100\n", "208.100.300.100\n"] >> >> I''ve done various things such as flattening, joining, etc. the >> hostipnumbers_columnized but it appears impossible to get them to >> display on individual lines in ruby-1.9.3 - without even considering >> code that will work equally as well with 1.8.7 >> >> Any suggestions? > > join() seems to work fine for making the string suitable: > > $ irb > ruby-1.9.3-head :001 > x = ["10.200.0.100\n", "208.100.300.100\n"] > => ["10.200.0.100\n", "208.100.300.100\n"] > ruby-1.9.3-head :002 > x.join > => "10.200.0.100\n208.100.300.100\n" > ruby-1.9.3-head :003 > puts x.join > 10.200.0.100 > 208.100.300.100 > => nil > ruby-1.9.3-head :004 > ^D > > Would it cause problems elsewhere if hostipnumbers_columnized were to > return results.join? What do you get in the text_area if you do that?---- .join("\r\n") did the trick. Needed to use double quotes and not single quotes (don''t understand why). Thanks... actually just stumbled onto this and was going back to my e-mail program to give it the old Roseanne Rosannadanna and saw your suggestion and the answer is yes (above) Thanks Craig -- 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.
For the simple reason that single quotes in Ruby do not allow for string interpolation (such as \r and \n), while double quotes do. On Tuesday, March 6, 2012 2:33:23 PM UTC-5, Craig White wrote:> > > .join("\r\n") did the trick. Needed to use double quotes and not single > quotes (don''t understand why). >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/sy51h_a59H0J. 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.
sure but that was in the model and by the time the ''string'' reached the view, the \r and \n were ''bare'' (no quotes) so in my mind, they should not have been a factor at all. On Mar 6, 2012, at 1:58 PM, Tim Shaffer wrote:> For the simple reason that single quotes in Ruby do not allow for string interpolation (such as \r and \n), while double quotes do. > > On Tuesday, March 6, 2012 2:33:23 PM UTC-5, Craig White wrote: > > .join("\r\n") did the trick. Needed to use double quotes and not single quotes (don''t understand why).-- 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.