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
4e6fac4c
Commit
4e6fac4c
authored
May 02, 2011
by
Dmitry Polushkin
Committed by
Prem Sichanugrist
Jun 20, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added possibility to the rake task to refresh only selected styles of the thumbnail.
Closes #466
parent
be74cebe
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
lib/tasks/paperclip.rake
+3
-2
No files found.
lib/tasks/paperclip.rake
View file @
4e6fac4c
...
...
@@ -20,14 +20,15 @@ namespace :paperclip do
task
:refresh
=>
[
"paperclip:refresh:metadata"
,
"paperclip:refresh:thumbnails"
]
namespace
:refresh
do
desc
"Regenerates thumbnails for a given CLASS (and optional ATTACHMENT)."
desc
"Regenerates thumbnails for a given CLASS (and optional ATTACHMENT
and STYLES splitted by comma
)."
task
:thumbnails
=>
:environment
do
errors
=
[]
klass
=
obtain_class
names
=
obtain_attachments
(
klass
)
styles
=
(
ENV
[
'STYLES'
]
||
ENV
[
'styles'
]
||
''
).
split
(
','
).
map
(
&
:to_sym
)
names
.
each
do
|
name
|
Paperclip
.
each_instance_with_attachment
(
klass
,
name
)
do
|
instance
|
result
=
instance
.
send
(
name
).
reprocess!
instance
.
send
(
name
).
reprocess!
(
*
styles
)
errors
<<
[
instance
.
id
,
instance
.
errors
]
unless
instance
.
errors
.
blank?
end
end
...
...
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