I really like this syntax, though I forgot what it was called
@notifications.delete_if{|x| x == cookie[0].to_i
but I would like to do something similar for find
<% @managers = User.find{|x| x.isAdmin == true} %>
any ideas?
currently my solution tells me it can’t find the object without an id, probably because I’m trying to treat active record like an array…
You could use
@managers = User.find_all_by_isAdmin(true)or@managers = User.find(:all, :conditions => ['isAdmin = ?', true]).Edit: To really be like what you have above, it might be something more along the lines of
User.all.select { |x| x.isAdmin == true }but that seems a little weird as you’d be fetching everything from the User table, when you don’t need to.