Created
March 17, 2012 16:21
-
-
Save mboeh/2061679 to your computer and use it in GitHub Desktop.
Celluloid thread local issues?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Just so I'm clear on the issue... | |
class Donut < ActiveRecord::Base | |
# ... | |
end | |
# This encounters the issue with fiber-local variables... | |
class Homer | |
include Celluloid | |
def initialize; @donuts = []; end | |
def buy_a_donut(id); @donuts << Donut.find(id); end | |
def eat_donuts; @donuts.each{|donut| donut.eaten = true; donut.save }; end | |
end | |
# But this doesn't? | |
class Homer | |
include Celluloid | |
def buy_and_eat_a_donut(id); Donut.find(id).tap{|donut| donut.eaten = true; donut.save }; end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment