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
a :dependent => :delete_all as an option on the has_many association.
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.
Environment:
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.
Some observations:
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
succeeds.
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)
end
class Preview < ActiveRecord::Base
belongs_to(:movie)
end
--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.