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.
Yan O. (Guest)
on 2008-11-12 15: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?
Thani A. (Guest)
on 2008-11-12 15:47
> After array initalization I want to revise several elements and delete
> them from the array. How can I delete?

@@available_columns.delete(obj)
Frederick C. (Guest)
on 2008-11-12 16:07
(Received via mailing list)
On 12 Nov 2008, at 13:47, Thani A. 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.