dragonfly 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.md +12 -0
- data/VERSION +1 -1
- data/dragonfly.gemspec +2 -2
- data/lib/dragonfly/active_record_extensions/validations.rb +4 -2
- data/lib/dragonfly/data_storage/s3data_store.rb +1 -0
- data/spec/dragonfly/active_record_extensions/migration.rb +1 -0
- data/spec/dragonfly/active_record_extensions/model_spec.rb +8 -0
- metadata +3 -3
data/History.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
0.6.2 (2010-06-24)
|
|
2
|
+
==================
|
|
3
|
+
Features
|
|
4
|
+
-----
|
|
5
|
+
- Added ability for custom error messages in validations
|
|
6
|
+
|
|
7
|
+
0.6.1 (2010-05-16)
|
|
8
|
+
==================
|
|
9
|
+
Fixes
|
|
10
|
+
-----
|
|
11
|
+
- STI was breaking when the model had a mixin too
|
|
12
|
+
|
|
1
13
|
0.6.0 (2010-05-11)
|
|
2
14
|
==================
|
|
3
15
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.6.
|
|
1
|
+
0.6.2
|
data/dragonfly.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{dragonfly}
|
|
8
|
-
s.version = "0.6.
|
|
8
|
+
s.version = "0.6.2"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Mark Evans"]
|
|
12
|
-
s.date = %q{2010-
|
|
12
|
+
s.date = %q{2010-06-24}
|
|
13
13
|
s.email = %q{mark@new-bamboo.co.uk}
|
|
14
14
|
s.extra_rdoc_files = [
|
|
15
15
|
"LICENSE",
|
|
@@ -15,8 +15,10 @@ module Dragonfly
|
|
|
15
15
|
validates_each(*args) do |record, attr, attachment|
|
|
16
16
|
if attachment
|
|
17
17
|
property = attachment.send(property_name)
|
|
18
|
-
record.errors.add
|
|
19
|
-
|
|
18
|
+
record.errors.add(attr,
|
|
19
|
+
opts[:message] ||
|
|
20
|
+
"#{property_name.to_s.humanize.downcase} is incorrect. It needs to be #{expected_values_string(allowed_values)}, but was '#{property}'"
|
|
21
|
+
) unless allowed_values.include?(property)
|
|
20
22
|
end
|
|
21
23
|
end
|
|
22
24
|
|
|
@@ -326,10 +326,12 @@ describe Item do
|
|
|
326
326
|
validates_property :mime_type, :of => :preview_image, :in => ['how/special', 'how/crazy'], :if => :its_friday
|
|
327
327
|
validates_property :mime_type, :of => [:other_image, :yet_another_image], :as => 'how/special'
|
|
328
328
|
validates_property :number_of_Gs, :of => :preview_image, :in => (0..2)
|
|
329
|
+
validates_property :mime_type, :of => :otra_imagen, :in => ['que/pasa', 'illo/tio'], :message => "tipo de contenido incorrecto. Que chungo tio"
|
|
329
330
|
|
|
330
331
|
image_accessor :preview_image
|
|
331
332
|
image_accessor :other_image
|
|
332
333
|
image_accessor :yet_another_image
|
|
334
|
+
image_accessor :otra_imagen
|
|
333
335
|
|
|
334
336
|
def its_friday
|
|
335
337
|
true
|
|
@@ -391,6 +393,12 @@ describe Item do
|
|
|
391
393
|
}.should raise_error(ArgumentError)
|
|
392
394
|
end
|
|
393
395
|
|
|
396
|
+
it "should allow for custom messages" do
|
|
397
|
+
@item.otra_imagen = "WRONG TYPE"
|
|
398
|
+
@item.should_not be_valid
|
|
399
|
+
@item.errors[:otra_imagen].should match_ar_error("tipo de contenido incorrecto. Que chungo tio")
|
|
400
|
+
end
|
|
401
|
+
|
|
394
402
|
end
|
|
395
403
|
|
|
396
404
|
describe "validates_mime_type_of" do
|
metadata
CHANGED
|
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
|
5
5
|
segments:
|
|
6
6
|
- 0
|
|
7
7
|
- 6
|
|
8
|
-
-
|
|
9
|
-
version: 0.6.
|
|
8
|
+
- 2
|
|
9
|
+
version: 0.6.2
|
|
10
10
|
platform: ruby
|
|
11
11
|
authors:
|
|
12
12
|
- Mark Evans
|
|
@@ -14,7 +14,7 @@ autorequire:
|
|
|
14
14
|
bindir: bin
|
|
15
15
|
cert_chain: []
|
|
16
16
|
|
|
17
|
-
date: 2010-
|
|
17
|
+
date: 2010-06-24 00:00:00 +01:00
|
|
18
18
|
default_executable:
|
|
19
19
|
dependencies:
|
|
20
20
|
- !ruby/object:Gem::Dependency
|