{"issue":{"created_at":"2011-12-12T16:39:42Z","state":"open","updated_at":"2011-12-12T16:45:10Z","user":{"gravatar_id":"4ec11ef1c9fc6ae80daa950c8a4fde03","id":109290,"url":"https://api.github.com/users/jumph4x","login":"jumph4x","avatar_url":"https://secure.gravatar.com/avatar/4ec11ef1c9fc6ae80daa950c8a4fde03?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"comments":1,"body":"Docs: http://api.rubyonrails.org/classes/ActiveSupport/Callbacks/ClassMethods.html\r\n\r\nSee: https://github.com/spree/spree/blob/master/core/app/models/spree/adjustment.rb#L36\r\n\r\nProblem: \r\nBlocks prevent effective use of this important piece of the Rails API when manipulating the callback collection. We can clear all callbacks of a particular type, but reinstating them is a problem. Also targeting specific callbacks for a type becomes a problem.\r\n\r\nExample: \r\nWe have an extension that registers a method with the order listener that is called every time Order#update! is called. The said extension creates Adjustment records, each of those calls Order#update! again. We have ourselves a SystemStackError. While arguably, and factually, not a fault with Spree, I believe the suggested way of registering callbacks to be cleaner and more flexible. Specifically, we should separate the callback logic from the callback registration. \r\n\r\nIf this is something you guys are interested in, I will gladly generate a pull request for master, simply let me know. ","assignee":null,"id":2525068,"labels":[],"number":863,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"title":"Use Method Name Symbols Instead of Proc Blocks in Callback Definitions","closed_at":null,"html_url":"https://github.com/spree/spree/issues/863","url":"https://api.github.com/repos/spree/spree/issues/863","milestone":null},"action":"created","comment":{"created_at":"2011-12-12T16:45:10Z","updated_at":"2011-12-12T16:45:10Z","user":{"gravatar_id":"4ec11ef1c9fc6ae80daa950c8a4fde03","id":109290,"url":"https://api.github.com/users/jumph4x","login":"jumph4x","avatar_url":"https://secure.gravatar.com/avatar/4ec11ef1c9fc6ae80daa950c8a4fde03?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"body":"What's worse, these block-defined callbacks are inherited by Rails models, and all Spree extensions seeking to expand on the Adjustment model.","id":3108590,"url":"https://api.github.com/repos/spree/spree/issues/comments/3108590"}}