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
c8a271eb
Commit
c8a271eb
authored
Jul 21, 2011
by
Jeremy Walker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed capitalize -> camelcase for storage module names.
parent
cfe406bf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
lib/paperclip/attachment.rb
+1
-1
test/attachment_test.rb
+15
-1
No files found.
lib/paperclip/attachment.rb
View file @
c8a271eb
...
@@ -323,7 +323,7 @@ module Paperclip
...
@@ -323,7 +323,7 @@ module Paperclip
end
end
def
initialize_storage
#:nodoc:
def
initialize_storage
#:nodoc:
storage_class_name
=
@storage
.
to_s
.
camelize
storage_class_name
=
@storage
.
to_s
.
downcase
.
camelize
begin
begin
@storage_module
=
Paperclip
::
Storage
.
const_get
(
storage_class_name
)
@storage_module
=
Paperclip
::
Storage
.
const_get
(
storage_class_name
)
rescue
NameError
rescue
NameError
...
...
test/attachment_test.rb
View file @
c8a271eb
...
@@ -496,6 +496,19 @@ class AttachmentTest < Test::Unit::TestCase
...
@@ -496,6 +496,19 @@ class AttachmentTest < Test::Unit::TestCase
rebuild_model
:storage
=>
:FileSystem
rebuild_model
:storage
=>
:FileSystem
@dummy
=
Dummy
.
new
@dummy
=
Dummy
.
new
assert
@dummy
.
avatar
.
is_a?
(
Paperclip
::
Storage
::
Filesystem
)
assert
@dummy
.
avatar
.
is_a?
(
Paperclip
::
Storage
::
Filesystem
)
rebuild_model
:storage
=>
:Filesystem
@dummy
=
Dummy
.
new
assert
@dummy
.
avatar
.
is_a?
(
Paperclip
::
Storage
::
Filesystem
)
end
should
"convert underscored storage name to camelcase"
do
rebuild_model
:storage
=>
:not_here
@dummy
=
Dummy
.
new
exception
=
assert_raises
(
Paperclip
::
StorageMethodNotFound
)
do
|
e
|
@dummy
.
avatar
end
assert
exception
.
message
.
include?
(
"NotHere"
)
end
end
should
"raise an error if you try to include a storage module that doesn't exist"
do
should
"raise an error if you try to include a storage module that doesn't exist"
do
...
@@ -1061,4 +1074,4 @@ class AttachmentTest < Test::Unit::TestCase
...
@@ -1061,4 +1074,4 @@ class AttachmentTest < Test::Unit::TestCase
end
end
end
end
end
end
\ No newline at end of file
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