Array.delete (object) is deleted from the database?
So, I was trying to just get an array of posts that don't include @post. To my surprise, the code below resulted in @post being removed from the database!
@post = Post.find(2)
@posts = Post.where(:text => "title")
@posts.delete(@post)
Why does the array function remove @post from the database? Does Rails extend or overwrite this functionality? I thought that only the .destroy function can delete objects from the database? I guess I'm confused about what exactly the .where function returns and the implications of using @ rather than using @ on variables.
Thanks in advance!
+3
source to share