Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
paperclip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
paperclip
Commits
526ced32
Commit
526ced32
authored
Jun 12, 2012
by
Matthew Schulkind
Committed by
Jon Yurek
Sep 14, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stop caching instance variables that the instance stores itself.
Fixes #913.
parent
de6af668
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
lib/paperclip/attachment.rb
+10
-7
No files found.
lib/paperclip/attachment.rb
View file @
526ced32
...
...
@@ -321,19 +321,22 @@ module Paperclip
# "avatar_file_name" field (assuming the attachment is called avatar).
def
instance_write
(
attr
,
value
)
setter
=
:"
#{
name
}
_
#{
attr
}
="
responds
=
instance
.
respond_to?
(
setter
)
self
.
instance_variable_set
(
"@_
#{
setter
.
to_s
.
chop
}
"
,
value
)
instance
.
send
(
setter
,
value
)
if
responds
||
attr
.
to_s
==
"file_name"
if
instance
.
respond_to?
(
setter
)
instance
.
send
(
setter
,
value
)
else
self
.
instance_variable_set
(
"@_
#{
setter
.
to_s
.
chop
}
"
,
value
)
end
end
# Reads the attachment-specific attribute on the instance. See instance_write
# for more details.
def
instance_read
(
attr
)
getter
=
:"
#{
name
}
_
#{
attr
}
"
responds
=
instance
.
respond_to?
(
getter
)
cached
=
self
.
instance_variable_get
(
"@_
#{
getter
}
"
)
return
cached
if
cached
instance
.
send
(
getter
)
if
responds
||
attr
.
to_s
==
"file_name"
if
instance
.
respond_to?
(
getter
)
instance
.
send
(
getter
)
else
self
.
instance_variable_get
(
"@_
#{
getter
}
"
)
end
end
private
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment