views:

68

answers:

0

I have this:

class Update < ActiveRecord::Base
  has_many :comments
end

class Comment < ActiveRecord::Base
  belongs_to :update
end

Update.first gives:

#<Update id: 1, body: "update 1", ...>

Comment.first gives:

#<Comment id: 1, update_id: 1, body: "comment 1", ...> 

When doing this:

Comment.first.update_attribute(:body,"This fails to be saved")

and then the comment still contains "comment 1" i.e. the record silently fails to be updated.

Now comes the weirdest part. When I remove 'belongs_to :update' from Comment then the update_attribute method succeeds.

Any ideas?