Forum: Ruby on Rails Help

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Chrisr (Guest)
on 2005-12-20 19:19
There is an Audit Type class

Each Audit Type has many Audit Items, they are accessible with the


It is possible to expire audit items, this sets the expired column to 1.
They still need to be linked with the Audit Type though, so i can not
delete the foreign key.

When i call AuditType.audit_items i dont want the items that have been
expired to show, but i do not know how to do this.  Any ideas on the
best way to do it??

Sean C. (Guest)
on 2008-11-25 17:27
(Received via mailing list)
Anything specific we can help with?

Adam van den Hoven (Guest)
on 2008-11-25 17:32
(Received via mailing list)
Some how this conjures up a scene from a John Wayne movie for me.

Developer In London (Guest)
on 2009-07-21 15:19
(Received via mailing list)
a bit more info would be useful.

2009/7/20 removed_email_address@domain.invalid 

> >


                       `6_ 6  )   `-.  (     ).`-.__.`)
                       (_Y_.)'  ._   )  `._ `. ``-..-'
                     _..`--'_..-_/  /--'_.' ,'
                    (il),-''  (li),'  ((!.-'
Stefano C. (Guest)
on 2010-01-08 07:22
(Received via mailing list)
On Thursday 07 January 2010, Jagadeesh wrote:
> |> > |       &&  (states.grep('open').empty? ||states.grep
> |> empty array and the puts will always be executed.
> |
> |Thanks

You don't need to use grep to see whether an array contains an element.
can use include?:

if (states.include?('closed') || states.include?('feedback')) &&
(states.include?('open') || states.include?('analyzed'))

Another aopproach is to use the Array & operator, which gives the
between two arrays. You can do something like this:

first_group = ['open', 'analyzed']
second_group = ['closed', 'feedback']

if !(states & second_group).empty? && !(states & first_group).empty?

The reasoning is that, if states contains either the 'open' or the
entries, then its intersection with first_group (states & first_group)
be empty. The same for the second group.

I hope this helps

This topic is locked and can not be replied to.