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
93f4f3cd
Commit
93f4f3cd
authored
Nov 30, 2008
by
Jon Yurek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#67 Fixed passing validations still existing in errors hash.
parent
c751827d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
2 deletions
+3
-2
lib/paperclip/attachment.rb
+2
-1
test/paperclip_test.rb
+1
-1
No files found.
lib/paperclip/attachment.rb
View file @
93f4f3cd
...
...
@@ -117,7 +117,7 @@ module Paperclip
# Returns true if there are no errors on this attachment.
def
valid?
validate
errors
.
length
==
0
errors
.
empty?
end
# Returns an array containing the errors on this attachment.
...
...
@@ -235,6 +235,7 @@ module Paperclip
errors
[
name
]
=
block
.
call
(
self
,
instance
)
if
block
errors
end
@validation_errors
.
reject!
{
|
k
,
v
|
v
==
nil
}
@errors
.
merge!
(
@validation_errors
)
end
@validation_errors
...
...
test/paperclip_test.rb
View file @
93f4f3cd
...
...
@@ -147,7 +147,7 @@ class PaperclipTest < Test::Unit::TestCase
@dummy
.
valid?
end
should
"not have an error when assigned a valid file"
do
assert
_nil
@dummy
.
avatar
.
errors
[
validation
]
assert
!
@dummy
.
avatar
.
errors
.
key?
(
validation
)
end
should
"not have an error on the attachment"
do
assert_nil
@dummy
.
errors
.
on
(
:avatar
)
...
...
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