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