Don't memoize in frozen objects. Closes #9

This commit is contained in:
Jonas Nicklas 2009-08-30 23:56:48 +02:00
parent 92364680a0
commit fca5eb2ea1
2 changed files with 4 additions and 2 deletions

View File

@ -232,6 +232,8 @@ module CarrierWave
private
def _mounter(column)
# We cannot memoize in frozen objects :(
return Mounter.new(self, column) if frozen?
@_mounters ||= {}
@_mounters[column] ||= Mounter.new(self, column)
end

View File

@ -164,7 +164,7 @@ describe CarrierWave::MongoMapper do
@doc = @class.new
end
context "when file assigned" do
describe "when file assigned" do
it "removes the file from the filesystem" do
@doc.image = stub_file('test.jpeg')
@ -178,7 +178,7 @@ describe CarrierWave::MongoMapper do
end
context "when file is not assigned" do
describe "when file is not assigned" do
it "deletes the instance of @class after save" do
@doc.save