Don't memoize in frozen objects. Closes #9
This commit is contained in:
parent
92364680a0
commit
fca5eb2ea1
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue