Remove Element from an ActiveRecord-hash without delete on DB
问题 how can i do this? all_tickets = Ticket.find(:all) all_tickets.each do |at| if at "a condition" all_tickets.delete(at) end end With this code i delete the at-element from database, but i only want to remove the at-element from the all_tickets ActiveRecord-Hash when the "a condition" is true. Thanks for Help 回答1: This solution has been converted to NOT use sql per your hint. In short, grab the tickets, loop over them and if the condition is true, delete the particular key from the attributes.