I've got a model, Favorite, that I'm trying to remove from the
database by calling the destroy method on it.  What's noteworthy about
this model is that it doesn't have an id column.  The unique index on
the Favorites table is a both the user_id and the article_id.  A
favorite belongs to a user and an article.

So in my destroy method of my Favorites Controller, I first retrieve
the favorite to delete:

favorite = Favorite.find_by_article_id_and_user_id(params[:id],
@current_user.id)

Then I call favorite.destroy and I notice this in the log:

"DELETE FROM favorites where id = NULL"

So the delete doesn't actually work.  What gives?  Do I HAVE to have
an id column in the favorites table?  Thanks for any help.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to