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?!
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?!
Ukrit H. 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???
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 H. [email protected]
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 H.
var1.all(:select => ‘var1.*’, :include => {:var2 => var3}, :conditions
=> [‘var3.something = ?’, some_value])
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 H.
not 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?
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs