Commit a16a50a1 by Jon Yurek

Remove unnecessary attribute caching

parent dc3cbbdd
......@@ -324,8 +324,6 @@ module Paperclip
setter = :"#{name}_#{attr}="
if instance.respond_to?(setter)
instance.send(setter, value)
else
self.instance_variable_set("@_#{setter.to_s.chop}", value)
end
end
......@@ -335,8 +333,6 @@ module Paperclip
getter = :"#{name}_#{attr}"
if instance.respond_to?(getter)
instance.send(getter)
else
self.instance_variable_get("@_#{getter}")
end
end
......
......@@ -1083,16 +1083,8 @@ class AttachmentTest < Test::Unit::TestCase
assert_nothing_raised { @dummy.avatar = @file }
end
should "return the time when sent #avatar_updated_at" do
now = Time.now
Time.stubs(:now).returns(now)
should "not return the time when sent #avatar_updated_at" do
@dummy.avatar = @file
assert_equal now.to_i, @dummy.avatar.updated_at.to_i
end
should "return nil when reloaded and sent #avatar_updated_at" do
@dummy.save
@dummy.reload
assert_nil @dummy.avatar.updated_at
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment