Displaying 2 results from an estimated 2 matches for "contactaddress".
Did you mean:
contact_address
2006 May 06
3
Question about one-to-many-to-many
Guys,
I''ve set up a 1-M-M relationship between 3 tables/models. I can''t get
cascading deletes (haven''t tried updates yet) to work when the master
record is deleted. I''m using MySQL 4.1.x, and the error message is:
Mysql::Error: #23000Cannot delete or update a parent row: a foreign key
constraint fails: DELETE FROM contact_addresses WHERE (contact_id = 1).
2007 Aug 03
0
acts_as_paranoid and Association Extensions (has_one troubles)
...* Example:
The disability of my approach you see below after the lines with
########### signs..
First on to: class Organization
class Organization < ActiveRecord::Base
acts_as_paranoid
has_one :contact_address, :as => :addressable, :dependent
=> :destroy do
def with_deleted
ContactAddress.with_scope(:find => {:conditions =>
"addressable_id = #{proxy_owner.id}"}) do
find_with_deleted(:all)
end
end
end
Loading development environment.
>> sc = SportClub.find_with_deleted(7)
=> #<SportClub:0xb769c1a4 @attributes={"number_of_members&quo...