I am developing a rails 3 application.
class Post < ActiveRecord::Base
has_many :attachments
has_many :photos
accepts_nested_attributes_for :attachments
Seems like since Rails 3.0.3, the association that you want to destroy (attachments, photos) need to be loaded. Take a look at this ticket. A quick fix, which isn't so elegant is to load your association in your update method:
@post = Post.includes(:attachments).find(params[:id])
if @post.update_attributes(params[:post])
redirect_to(posts_url, :notice => 'Post updated.'
else
render :action => "edit"
end
FYI this is still necessary for Rails 3.0.4.