Skip to content
This repository has been archived by the owner on Jun 30, 2021. It is now read-only.

has_many through relation not getting affected in rails 3.2.13 #121

Open
ami1906 opened this issue Jul 29, 2013 · 1 comment
Open

has_many through relation not getting affected in rails 3.2.13 #121

ami1906 opened this issue Jul 29, 2013 · 1 comment

Comments

@ami1906
Copy link

ami1906 commented Jul 29, 2013

This is my scenario.
class Message < ActiveRecord::Base
belongs_to :user, :foreign_key => "from_user_id"
has_many :message_recipients, :include => [:user], :dependent => :destroy
has_many :recipients, :through => :message_recipients, :source => :user
end

class MessageRecipient < ActiveRecord::Base
belongs_to :user
belongs_to :message, :include => :message_recipients
end

class User < ActiveRecord::Base
acts_as_paranoid
has_many :message_recipients
end

@test=Message.new
@test.name="Test";
@test.recipients.push(User.find(1))
@test.save

Without paranoid: The above code works fine if i remove acts_as_paranoid from user model.
WIth paranoid: It saves only the parent record(Message) but fails to save the child record(MessageRecipient) in rails 3.2.13.But the same code works fine with rails 3.2.12. It seems to be a wierd behaviour.

@christopherchiu
Copy link
Collaborator

That does seem like a very weird behavior. Let me look into it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants