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
4f85dd44
Commit
4f85dd44
authored
Aug 18, 2010
by
Jon Yurek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly load the storage modules.
parent
56d6b240
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
2 deletions
+22
-2
lib/paperclip/attachment.rb
+2
-2
test/attachment_test.rb
+20
-0
No files found.
lib/paperclip/attachment.rb
View file @
4f85dd44
...
@@ -276,9 +276,9 @@ module Paperclip
...
@@ -276,9 +276,9 @@ module Paperclip
def
initialize_storage
#:nodoc:
def
initialize_storage
#:nodoc:
storage_name
=
@storage
.
to_s
.
capitalize
storage_name
=
@storage
.
to_s
.
capitalize
begin
begin
require
"paperclip/storage/
#{
storage_nam
e
}
"
require
"paperclip/storage/
#{
@storag
e
}
"
rescue
MissingSourceFile
rescue
MissingSourceFile
raise
StorageMethodNotFound
,
"Cannot find
#{
storage_name
}
"
raise
StorageMethodNotFound
,
"Cannot find
the '
#{
@storage
}
' storage adapter.
"
end
end
@storage_module
=
Paperclip
::
Storage
.
const_get
(
storage_name
)
@storage_module
=
Paperclip
::
Storage
.
const_get
(
storage_name
)
self
.
extend
(
@storage_module
)
self
.
extend
(
@storage_module
)
...
...
test/attachment_test.rb
View file @
4f85dd44
...
@@ -338,6 +338,26 @@ class AttachmentTest < Test::Unit::TestCase
...
@@ -338,6 +338,26 @@ class AttachmentTest < Test::Unit::TestCase
end
end
end
end
should
"include the filesystem module when loading the filesystem storage"
do
rebuild_model
:storage
=>
:filesystem
@dummy
=
Dummy
.
new
assert
@dummy
.
avatar
.
is_a?
(
Paperclip
::
Storage
::
Filesystem
)
end
should
"include the filesystem module even if capitalization is wrong"
do
rebuild_model
:storage
=>
:FileSystem
@dummy
=
Dummy
.
new
assert
@dummy
.
avatar
.
is_a?
(
Paperclip
::
Storage
::
Filesystem
)
end
should
"raise an error if you try to include a storage module that doesn't exist"
do
rebuild_model
:storage
=>
:not_here
@dummy
=
Dummy
.
new
assert_raises
(
Paperclip
::
StorageMethodNotFound
)
do
@dummy
.
avatar
end
end
context
"An attachment with styles but no processors defined"
do
context
"An attachment with styles but no processors defined"
do
setup
do
setup
do
rebuild_model
:processors
=>
[],
:styles
=>
{
:something
=>
'1'
}
rebuild_model
:processors
=>
[],
:styles
=>
{
:something
=>
'1'
}
...
...
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