mm-attach-it 0.1.5 → 0.2.0
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/Gemfile +5 -1
- data/README +4 -0
- data/README.rdoc +4 -0
- data/lib/attach_it/attach_it.rb +10 -6
- data/lib/attach_it/version.rb +1 -1
- metadata +9 -9
data/Gemfile
CHANGED
data/README
CHANGED
data/README.rdoc
CHANGED
data/lib/attach_it/attach_it.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
module AttachIt
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
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
|
-
|
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
|
-
:
|
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
|
-
:
|
62
|
+
:in => allowed_types,
|
59
63
|
:message => message,
|
60
64
|
:allow_nil => true
|
61
65
|
end
|
data/lib/attach_it/version.rb
CHANGED
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:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
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-
|
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:
|
43
|
+
hash: 59
|
44
44
|
segments:
|
45
45
|
- 0
|
46
|
-
-
|
47
|
-
-
|
48
|
-
version: 0.
|
46
|
+
- 9
|
47
|
+
- 0
|
48
|
+
version: 0.9.0
|
49
49
|
type: :runtime
|
50
50
|
version_requirements: *id002
|
51
51
|
- !ruby/object:Gem::Dependency
|