{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/24649","repository_url":"https://api.github.com/repos/rails/rails","labels_url":"https://api.github.com/repos/rails/rails/issues/24649/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/24649/comments","events_url":"https://api.github.com/repos/rails/rails/issues/24649/events","html_url":"https://github.com/rails/rails/issues/24649","id":149747474,"number":24649,"title":"has_many through tries to write a readonly model","user":{"login":"bquorning","id":22333,"avatar_url":"https://avatars.githubusercontent.com/u/22333?v=3","gravatar_id":"","url":"https://api.github.com/users/bquorning","html_url":"https://github.com/bquorning","followers_url":"https://api.github.com/users/bquorning/followers","following_url":"https://api.github.com/users/bquorning/following{/other_user}","gists_url":"https://api.github.com/users/bquorning/gists{/gist_id}","starred_url":"https://api.github.com/users/bquorning/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bquorning/subscriptions","organizations_url":"https://api.github.com/users/bquorning/orgs","repos_url":"https://api.github.com/users/bquorning/repos","events_url":"https://api.github.com/users/bquorning/events{/privacy}","received_events_url":"https://api.github.com/users/bquorning/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rails/rails/labels/activerecord","name":"activerecord","color":"0b02e1"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-04-20T11:58:18Z","updated_at":"2016-04-24T20:59:26Z","closed_at":"2016-04-20T14:00:46Z","body":"When I have a “has_many through” association where the “has_many” class is readonly, I get an error when replacing or adding to the collection – that the collection class “is marked as readonly”.\r\n\r\nI believe d849f42b4ecf687ed5350f5a2402fb795aa33aac is the first offending commit. It should probably have replaced `if record.new_record?` with `if !record.readonly?` instead of removing the condition.\r\n\r\nGist in https://gist.github.com/bquorning/55dffab8e8038fbe0119ef6d854a5090\r\n\r\n### System configuration\r\n**Rails version**: v5.0.0.beta1 and later. Master branch since commit d849f42b4ecf687ed5350f5a2402fb795aa33aac.\r\n\r\n**Ruby version**: Tested with 2.3.0\r\n"},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/214036363","html_url":"https://github.com/rails/rails/issues/24649#issuecomment-214036363","issue_url":"https://api.github.com/repos/rails/rails/issues/24649","id":214036363,"user":{"login":"maclover7","id":3020626,"avatar_url":"https://avatars.githubusercontent.com/u/3020626?v=3","gravatar_id":"","url":"https://api.github.com/users/maclover7","html_url":"https://github.com/maclover7","followers_url":"https://api.github.com/users/maclover7/followers","following_url":"https://api.github.com/users/maclover7/following{/other_user}","gists_url":"https://api.github.com/users/maclover7/gists{/gist_id}","starred_url":"https://api.github.com/users/maclover7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maclover7/subscriptions","organizations_url":"https://api.github.com/users/maclover7/orgs","repos_url":"https://api.github.com/users/maclover7/repos","events_url":"https://api.github.com/users/maclover7/events{/privacy}","received_events_url":"https://api.github.com/users/maclover7/received_events","type":"User","site_admin":false},"created_at":"2016-04-24T20:59:26Z","updated_at":"2016-04-24T20:59:26Z","body":"Sorry @bquorning, I think it's @sgrif's decision about what gets accepted or not, since he's one of the lead contributors to Active Record 😬 "}}