dragonfly 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of dragonfly might be problematic. Click here for more details.

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
1
+ 0.6.2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{dragonfly}
8
- s.version = "0.6.1"
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-05-16}
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 attr, "#{property_name.to_s.humanize.downcase} is incorrect. It needs to be #{expected_values_string(allowed_values)}," +
19
- " but was '#{property}'" unless allowed_values.include?(property)
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
 
@@ -29,6 +29,7 @@ module Dragonfly
29
29
  ensure_initialized
30
30
  object = use_filesystem ? temp_object.file : temp_object.data
31
31
  S3Object.store(uid, object, bucket_name)
32
+ object.close if use_filesystem
32
33
  uid
33
34
  end
34
35
 
@@ -18,6 +18,7 @@ class MigrationForTest < ActiveRecord::Migration
18
18
  t.string :preview_image_blah_blah
19
19
  t.string :other_image_uid
20
20
  t.string :yet_another_image_uid
21
+ t.string :otra_imagen_uid
21
22
  t.string :trailer_video_uid
22
23
  t.timestamps
23
24
  end
@@ -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
- - 1
9
- version: 0.6.1
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-05-16 00:00:00 +01:00
17
+ date: 2010-06-24 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency