Forum: Ruby on Rails How to revise array

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
B0e2011a2e6e23e05262397c76ef4dcb?d=identicon&s=25 Yan Oleg (yan-oleg)
on 2008-11-12 14:38
I have the following code:

@@available_columns = [
    QueryColumn.new(:tracker, :sortable =>
"#{Tracker.table_name}.position"),
    QueryColumn.new(:root_cause, :sortable =>
"#{RootCause.table_name}.position"),
   QueryColumn.new(:project, :sortable => "#{Project.table_name}.name"),

.....

]

After array initalization I want to revise several elements and delete
them from the array. How can I delete?
C5c0e0499446b84fd3bcc61cf7862539?d=identicon&s=25 Thani Ararsu (thaniyarasu)
on 2008-11-12 14:47
> After array initalization I want to revise several elements and delete
> them from the array. How can I delete?

@@available_columns.delete(obj)
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2008-11-12 15:07
(Received via mailing list)
On 12 Nov 2008, at 13:47, Thani Ararsu wrote:

>
>
>> After array initalization I want to revise several elements and
>> delete
>> them from the array. How can I delete?
>
> @@available_columns.delete(obj)

reject, delete_if and friends are often useful too.

Fred
This topic is locked and can not be replied to.