I got a application like following.

A board has many posts
All posts belong to a board

I try to destroy all the posts under a board when I destroy the board.
My destroy function is following.

  def destroy
    @board = Board.find(params[:id])
    @post = @board.posts
    @post.destroy
    @board.destroy

    respond_to do |format|
      format.html { redirect_to(boards_url) }
      format.xml  { head :ok }
    end
  end

However, it does not work.
Could anyone tell me how to destroy all the posts when the board is
destroyed?

My source code is following.
http://dl.dropbox.com/u/40209252/forum_demo.tar.gz

-- 
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.

Reply via email to