Is it possible to delete a record or to nullify the foreign key for a
record that is associated using a belongs_to association?
For example:
class BelieverOrNot < ActiveRecord::Base
belongs_to :deity, :foreign_key => 'deity_id'
end
believer = new BelieverOrNot( :deity =>
Deity.find_by_num_worshippers('5') )
# Our believer stops believing, but the reference can't be destroyed
believer.deity = nil # Doesn't work
believer.deity_id = nil # Neither does this
After saving "believer", the foreign key will still hold the same old
value. What's wrong with this? What are we doing wrong?
- Rowan
--
Morality is usually taught by the immoral.
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails