{"action":"created","issue":{"url":"https://api.github.com/repos/thoughtbot/paperclip/issues/1605","repository_url":"https://api.github.com/repos/thoughtbot/paperclip","labels_url":"https://api.github.com/repos/thoughtbot/paperclip/issues/1605/labels{/name}","comments_url":"https://api.github.com/repos/thoughtbot/paperclip/issues/1605/comments","events_url":"https://api.github.com/repos/thoughtbot/paperclip/issues/1605/events","html_url":"https://github.com/thoughtbot/paperclip/issues/1605","id":38105117,"number":1605,"title":"after_initialize doesn't allow validations","user":{"login":"rsiddle","id":18415,"avatar_url":"https://avatars.githubusercontent.com/u/18415?v=3","gravatar_id":"","url":"https://api.github.com/users/rsiddle","html_url":"https://github.com/rsiddle","followers_url":"https://api.github.com/users/rsiddle/followers","following_url":"https://api.github.com/users/rsiddle/following{/other_user}","gists_url":"https://api.github.com/users/rsiddle/gists{/gist_id}","starred_url":"https://api.github.com/users/rsiddle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsiddle/subscriptions","organizations_url":"https://api.github.com/users/rsiddle/orgs","repos_url":"https://api.github.com/users/rsiddle/repos","events_url":"https://api.github.com/users/rsiddle/events{/privacy}","received_events_url":"https://api.github.com/users/rsiddle/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2014-07-17T17:16:52Z","updated_at":"2016-05-10T19:53:29Z","closed_at":null,"body":"My model requires the attachment to be initalized afterwards because I need to decide whether the Fog gem is set to public or private. The problem I'm facing is that the validations then fail giving me the following error:\r\n\r\n    undefined method `_attachment_post_process_callbacks' for #<Class:0x007f891b8389b0>\r\n\r\nThe error points to the validates_attachment_content_type. The code for the model is:\r\n\r\n    after_initialize :init_attachment\r\n\r\n    validates_attachment_content_type :attachment,\r\n     :content_type => ['image/png', 'image/jpeg', 'image/jpg', 'image/gif']\r\n\r\n     def init_attachment\r\n       self.class.has_attached_file :attachment,\r\n         :styles => lambda { |attachment|\r\n           !attachment.instance.is_type_of_image? ? {} : {\r\n             thumb: '100x1  ',\r\n             small: '200x2  ',\r\n             medium: '300x300>',\r\n             large: '550x250>'}\r\n         },\r\n         :styles => {\r\n           :medium => { :geometry => \"640x480\", :format => 'mp4', :convert_options => {:output => {:ar => 44100}} },\r\n           :large => { :geometry => \"1024x576\", :format => 'mp4', :convert_options => {:output => {:ar => 44100}} },\r\n         }, :processors => [:ffmpeg],\r\n         default_url: \"/uploads/:post_type/missing.png\",\r\n         url: \"/uploads/:style/:permalink/:basename.:extension\",\r\n         path: \"uploads/:style/:permalink/:basename.:extension\",\r\n         fog_public: self.is_public?\r\n      end\r\n\r\nAny thoughts on a work around for this? "},"comment":{"url":"https://api.github.com/repos/thoughtbot/paperclip/issues/comments/218271471","html_url":"https://github.com/thoughtbot/paperclip/issues/1605#issuecomment-218271471","issue_url":"https://api.github.com/repos/thoughtbot/paperclip/issues/1605","id":218271471,"user":{"login":"tute","id":54260,"avatar_url":"https://avatars.githubusercontent.com/u/54260?v=3","gravatar_id":"","url":"https://api.github.com/users/tute","html_url":"https://github.com/tute","followers_url":"https://api.github.com/users/tute/followers","following_url":"https://api.github.com/users/tute/following{/other_user}","gists_url":"https://api.github.com/users/tute/gists{/gist_id}","starred_url":"https://api.github.com/users/tute/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tute/subscriptions","organizations_url":"https://api.github.com/users/tute/orgs","repos_url":"https://api.github.com/users/tute/repos","events_url":"https://api.github.com/users/tute/events{/privacy}","received_events_url":"https://api.github.com/users/tute/received_events","type":"User","site_admin":false},"created_at":"2016-05-10T19:53:29Z","updated_at":"2016-05-10T19:53:29Z","body":"Failing early will be an improvement indeed."}}