I have a simple has_many relationship between a Movie and its
Previews. I've verified that the previews table has a foreign key to
its parent record in the movies table. I've added the has_many with
The problem I'm seeing is that when I delete a movie, I am not seeing
any attempt of error in trying to delete the child previews records.
The movie is deleted from the database.
I am running Rails 3.1.1 with Ruby 1.9.2 and have tried both
Postgresql and Sqlite3 as my databases on my local OS X environment.
Any insight to this problem (potentially self inflicted) will be
appreciated. Thanks in advance.
I can instantiate the movie and get its previews as in:
Movie.find(12).previews and that succeeds. I can also locate a preview
and reference its parent movie as in Preview.find(100).movie and that
Troubleshooting: I've tried using the :destroy_all and even :nullify
but still dont' see any attempt to handle the dependent activity. I've
modified my database.yml to use SQLite3 instead of Postgresql and that
didn't seem to help.
My ActiveRecord model class definitions look like this:
class Movie < ActiveRecord::Base
has_many(:previews, :dependent => :delete_all)
class Preview < ActiveRecord::Base