{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/23538","repository_url":"https://api.github.com/repos/rails/rails","labels_url":"https://api.github.com/repos/rails/rails/issues/23538/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/23538/comments","events_url":"https://api.github.com/repos/rails/rails/issues/23538/events","html_url":"https://github.com/rails/rails/issues/23538","id":131941524,"number":23538,"title":"accepts_nested_attributes_for  in STI","user":{"login":"jbmyid","id":1590395,"avatar_url":"https://avatars.githubusercontent.com/u/1590395?v=3","gravatar_id":"","url":"https://api.github.com/users/jbmyid","html_url":"https://github.com/jbmyid","followers_url":"https://api.github.com/users/jbmyid/followers","following_url":"https://api.github.com/users/jbmyid/following{/other_user}","gists_url":"https://api.github.com/users/jbmyid/gists{/gist_id}","starred_url":"https://api.github.com/users/jbmyid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbmyid/subscriptions","organizations_url":"https://api.github.com/users/jbmyid/orgs","repos_url":"https://api.github.com/users/jbmyid/repos","events_url":"https://api.github.com/users/jbmyid/events{/privacy}","received_events_url":"https://api.github.com/users/jbmyid/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rails/rails/labels/activerecord","name":"activerecord","color":"0b02e1"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-07T06:09:57Z","updated_at":"2016-02-08T20:50:27Z","closed_at":null,"body":"I am facing Issue when trying to destroy using nested attribute for STI classes in rails 4. eg:\r\n\r\n```\r\nclass A < ActiveRecord::Base\r\nend\r\n\r\nclass B < A\r\n  has_many :options\r\n  accepts_nested_attributes_for :options, :allow_destroy => true\r\nend\r\n```\r\nWhen I try to delete the options its not being deleted event it is has marked_for_destruction? as true, but the option is not being deleted.\r\n\r\nI have all correct paramaters accessible like `:id, :name, :_destroy.`\r\n\r\n\r\nI made it working by moving nested attributes code and has_many to base class.\r\n\r\n```\r\nclass A < ActiveRecord::Base\r\n  has_many :options\r\n  accepts_nested_attributes_for :options, :allow_destroy => true\r\nend\r\n\r\nclass B < A\r\n\r\nend\r\n```\r\nI think its issue with STI in rails same as you can not update the type of the STI class object(there is workaround fix for that)."},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/181561945","html_url":"https://github.com/rails/rails/issues/23538#issuecomment-181561945","issue_url":"https://api.github.com/repos/rails/rails/issues/23538","id":181561945,"user":{"login":"pauloancheta","id":9355943,"avatar_url":"https://avatars.githubusercontent.com/u/9355943?v=3","gravatar_id":"","url":"https://api.github.com/users/pauloancheta","html_url":"https://github.com/pauloancheta","followers_url":"https://api.github.com/users/pauloancheta/followers","following_url":"https://api.github.com/users/pauloancheta/following{/other_user}","gists_url":"https://api.github.com/users/pauloancheta/gists{/gist_id}","starred_url":"https://api.github.com/users/pauloancheta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pauloancheta/subscriptions","organizations_url":"https://api.github.com/users/pauloancheta/orgs","repos_url":"https://api.github.com/users/pauloancheta/repos","events_url":"https://api.github.com/users/pauloancheta/events{/privacy}","received_events_url":"https://api.github.com/users/pauloancheta/received_events","type":"User","site_admin":false},"created_at":"2016-02-08T20:50:26Z","updated_at":"2016-02-08T20:50:26Z","body":"It passes with this test case. Let me know if there is something I can improve with the test.\r\nhttps://gist.github.com/pauloancheta/fcba7ca7417758a4e11c"}}