Hi, I'm new in Ruby on Rails and I don't know how can I achive
something like this:
@switchs = Switch.find(:all)
for switch in @switchs
if current_user.shifts.count(:all,:conditions=>["date = ? and
shift = ?",switch.destiny_date, switch.destiny_turn]) !=0
@valid = switch
Let me explain. I just want to put in the same @valid object, switchs
that satisfy the "if" condition. So, I have to loop for every switch
and just select those ones that satisfy the condition. Is there any
way to achieve this???
Thanks in advance.