mm-attach-it 0.1.5 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1 +1,5 @@
1
- source "http://rubygems.org"
1
+ source :rubygems
2
+ source Source::Git.new("uri" => "git://github.com/jnunemaker/mongomapper.git")
3
+ gem 'i18n', '0.4.2'
4
+ gem 'bson_ext', '~> 1.2.4', :require => false
5
+ gemspec
data/README CHANGED
@@ -10,6 +10,10 @@ Or add it to your Rails’s Gemfile::
10
10
 
11
11
  gem "mm-attach-it"
12
12
 
13
+ If you are using Mongo Mapper 0.8.x or later
14
+
15
+ gem "mm-attach-it", "~> 0.1.5"
16
+
13
17
  == Usage
14
18
 
15
19
  === Model
data/README.rdoc CHANGED
@@ -10,6 +10,10 @@ Or add it to your Rails’s Gemfile::
10
10
 
11
11
  gem "mm-attach-it"
12
12
 
13
+ If you are using Mongo Mapper 0.8.x or later
14
+
15
+ gem "mm-attach-it", "~> 0.1.5"
16
+
13
17
  == Usage
14
18
 
15
19
  === Model
@@ -1,8 +1,8 @@
1
1
  module AttachIt
2
2
 
3
- def self.configure(model)
4
- model.class_eval do
5
- end
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
6
  end
7
7
 
8
8
  module ClassMethods
@@ -26,7 +26,11 @@ module AttachIt
26
26
  information_for(name, options)
27
27
  end
28
28
 
29
- validates_each name, :logic => lambda { information_for(name, options).send(:flush_errors) }
29
+
30
+ validates_each(name) do |record, attr, value|
31
+ record.information_for(name, options).send(:flush_errors)
32
+ end
33
+
30
34
  end
31
35
 
32
36
  def validates_attachment_size(name = nil, options = {})
@@ -37,7 +41,7 @@ module AttachIt
37
41
  message = message.gsub(/:min/, min.to_s).gsub(/:max/, max.to_s)
38
42
 
39
43
  validates_inclusion_of :"#{name}_file_size",
40
- :within => range,
44
+ :in => range,
41
45
  :message => message,
42
46
  :allow_nil => true
43
47
  end
@@ -55,7 +59,7 @@ module AttachIt
55
59
  message = options[:message] || "is not one of #{allowed_types.join(", ")}"
56
60
 
57
61
  validates_inclusion_of :"#{name}_content_type",
58
- :within => allowed_types,
62
+ :in => allowed_types,
59
63
  :message => message,
60
64
  :allow_nil => true
61
65
  end
@@ -1,3 +1,3 @@
1
1
  module AttachIt
2
- Version = '0.1.5'
2
+ Version = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mm-attach-it
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
9
- - 5
10
- version: 0.1.5
8
+ - 2
9
+ - 0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Adilson Chacon
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-14 00:00:00 Z
18
+ date: 2011-07-15 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: wand
@@ -40,12 +40,12 @@ dependencies:
40
40
  requirements:
41
41
  - - ~>
42
42
  - !ruby/object:Gem::Version
43
- hash: 51
43
+ hash: 59
44
44
  segments:
45
45
  - 0
46
- - 8
47
- - 6
48
- version: 0.8.6
46
+ - 9
47
+ - 0
48
+ version: 0.9.0
49
49
  type: :runtime
50
50
  version_requirements: *id002
51
51
  - !ruby/object:Gem::Dependency