On Sun, Feb 20, 2011 at 8:47 AM, Juan manuel V. <[email protected]>wrote:
> Hi, im new to Ruby on Rails and im trying to do the following > > i = 1 > @elements = Post.find(:all) > @elements.each do |el| > if el.name=="test" > # remove el from @elements > end > end > > from http://www.ruby-doc.org/core/classes/Array.html#M000259 @elements.reject! {|el| el.name == 'test'} > > How can i achieve this? i was trying to do > el.delete but that is going to delete the element from the database > and i just want the element to be removed from current listing. im > implementing a search functionality and i want to filter the results > from Post.find(:all). In the real app i cant do it by sql. > Thanks > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- ------------------------------------------------------------- visit my blog at http://jimlabs.heroku.com -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

