suppose that I''ve some kind of array like this var1[0].var2[0].var3 So I would like to remove var3 out of this nest array what I should do? and after I tried to use delete It''s also delete some important value out from database any idea?! -- 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 -~----------~----~----~----~------~----~------~--~---
Ukrit Himakoon wrote:> suppose that I''ve some kind of array like this > > var1[0].var2[0].var3 > > So I would like to remove var3 out of this nest array > what I should do? > > and after I tried to use delete It''s also delete some important value > out from database any idea?!hello??????????? -- 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 -~----------~----~----~----~------~----~------~--~---
a=["a","b","c"] a.pop="c" a is now ["a","b"] Is that what you want? Martin On Jan 26, 9:19 am, Ukrit Himakoon <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Ukrit Himakoon wrote: > > suppose that I''ve some kind of array like this > > > var1[0].var2[0].var3 > > > So I would like to remove var3 out of this nest array > > what I should do? > > > and after I tried to use delete It''s also delete some important value > > out from database any idea?! > > hello??????????? > -- > Posted viahttp://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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Would you like to remove the object that contains var3? var3 isn'' at the nested array, it''s a nested property of an object that is in there. If you wanted to remove it, it would be like this: var1[0].var2.delete_at( 0 ) - Maurício Linhares http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en) On Mon, Jan 26, 2009 at 5:50 AM, Ukrit Himakoon <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > suppose that I''ve some kind of array like this > > var1[0].var2[0].var3 > > So I would like to remove var3 out of this nest array > what I should do? > > and after I tried to use delete It''s also delete some important value > out from database any idea?! > -- > 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Maurício Linhares wrote:> Would you like to remove the object that contains var3? > > var3 isn'' at the nested array, it''s a nested property of an object > that is in there. > > If you wanted to remove it, it would be like this: > > var1[0].var2.delete_at( 0 ) > > - > Maur�o Linhares > http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ > (en) > > > > On Mon, Jan 26, 2009 at 5:50 AM, Ukrit Himakoonnot really what I want is removing element inside an array built from query (use in display purpose). but when I''m trying to delete the element inside database also deleted. for more clearer explanation please see this: I''ve got database contains stuff like this: var1 - has_many var2 var2 - belongs to var1 and belongs to var2 var3 - has_many var2 So what I''m doing is variable1 = var1.find(:all) but I need only var1 which not contains some contents in var3 that''s why I need to trace and remove from var3 element. any Idea? -- 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
var1.all(:select => ''var1.*'', :include => {:var2 => var3}, :conditions => [''var3.something = ?'', some_value]) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---