class Message < ActiveRecord::Base
belongs_to :author
accepts_nested_attributes_for :author
end
I’m using the above and it’s working perfectly. The message gets saved
with an author_id attribute which references the author (tha author
record gets saved too).
The problem:
Sometimes I don’t want to save the author because the author already
exists (I just want to reference it). I just want the message to get
saved with the author_id reference. How can I override or modify the
normal saving behaviour when using the accepts_nested_attributes_for
method?
Thanks,
ElÃas