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
cd856aa0
Commit
cd856aa0
authored
Oct 14, 2011
by
Prem Sichanugrist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update rake task to fix issue with `rake paperclip:clean`
Closes #602
parent
898baf2c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
features/rake_tasks.feature
+0
-1
lib/tasks/paperclip.rake
+9
-5
No files found.
features/rake_tasks.feature
View file @
cd856aa0
...
...
@@ -47,7 +47,6 @@ Feature: Rake tasks
Then
the attachment file
"original/5k.png"
should exist
And
the attachment file
"medium/5k.png"
should exist
@wip
Scenario
:
Paperclip clean task
When
I upload the fixture
"5k.png"
And
I upload the fixture
"12k.png"
...
...
lib/tasks/paperclip.rake
View file @
cd856aa0
...
...
@@ -84,12 +84,16 @@ namespace :paperclip do
names
=
Paperclip
::
Task
.
obtain_attachments
(
klass
)
names
.
each
do
|
name
|
Paperclip
.
each_instance_with_attachment
(
klass
,
name
)
do
|
instance
|
instance
.
send
(
name
).
send
(
:validate
)
if
instance
.
send
(
name
).
valid?
true
else
unless
instance
.
valid?
attributes
=
%w(file_size file_name content_type)
.
map
{
|
suffix
|
"
#{
name
}
_
#{
suffix
}
"
.
to_sym
}
if
attributes
.
any?
{
|
attribute
|
instance
.
errors
[
attribute
].
present?
}
instance
.
send
(
"
#{
name
}
="
,
nil
)
instance
.
save
if
Rails
.
version
>=
"3.0.0"
instance
.
save
(
:validate
=>
false
)
else
instance
.
save
(
false
)
end
end
end
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