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
e8f45902
Commit
e8f45902
authored
Dec 11, 2008
by
Jon Yurek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#43 Applied patch to avoid instance variable conflict.
parent
4c64f655
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
2 deletions
+21
-2
lib/paperclip.rb
+2
-2
test/integration_test.rb
+19
-0
No files found.
lib/paperclip.rb
View file @
e8f45902
...
@@ -232,8 +232,8 @@ module Paperclip
...
@@ -232,8 +232,8 @@ module Paperclip
module InstanceMethods #:nodoc:
module InstanceMethods #:nodoc:
def attachment_for name
def attachment_for name
@attachments ||= {}
@
_paperclip_
attachments ||= {}
@attachments[name] ||= Attachment.new(name, self, self.class.attachment_definitions[name])
@
_paperclip_
attachments[name] ||= Attachment.new(name, self, self.class.attachment_definitions[name])
end
end
def each_attachment
def each_attachment
...
...
test/integration_test.rb
View file @
e8f45902
...
@@ -263,6 +263,25 @@ class IntegrationTest < Test::Unit::TestCase
...
@@ -263,6 +263,25 @@ class IntegrationTest < Test::Unit::TestCase
end
end
context
"A model with an attachments association and a Paperclip attachment"
do
setup
do
Dummy
.
class_eval
do
has_many
:attachments
,
:class_name
=>
'Dummy'
end
@dummy
=
Dummy
.
new
@dummy
.
avatar
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
"fixtures"
,
"5k.png"
),
'rb'
)
end
should
"should not error when saving"
do
assert_nothing_raised
do
@dummy
.
save!
end
end
end
if
ENV
[
'S3_TEST_BUCKET'
]
if
ENV
[
'S3_TEST_BUCKET'
]
def
s3_files_for
attachment
def
s3_files_for
attachment
[
:thumb
,
:medium
,
:large
,
:original
].
inject
({})
do
|
files
,
style
|
[
:thumb
,
:medium
,
:large
,
:original
].
inject
({})
do
|
files
,
style
|
...
...
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