Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove unnecessary attribute caching

  • Loading branch information...
commit a16a50a106432091fff0bf0ac398066803bb8791 1 parent dc3cbbd
@jyurek jyurek authored
Showing with 1 addition and 13 deletions.
  1. +0 −4 lib/paperclip/attachment.rb
  2. +1 −9 test/attachment_test.rb
View
4 lib/paperclip/attachment.rb
@@ -324,8 +324,6 @@ def instance_write(attr, value)
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 @@ def instance_read(attr)
getter = :"#{name}_#{attr}"
if instance.respond_to?(getter)
instance.send(getter)
- else
- self.instance_variable_get("@_#{getter}")
end
end
View
10 test/attachment_test.rb
@@ -1083,16 +1083,8 @@ def do_after_all; end
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
Please sign in to comment.
Something went wrong with that request. Please try again.