bulldog 0.2.3 → 0.2.4
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/CHANGELOG +5 -0
- data/lib/bulldog/has_attachment.rb +5 -3
- data/lib/bulldog/version.rb +1 -1
- data/spec/unit/has_attachment_spec.rb +11 -2
- metadata +4 -4
data/CHANGELOG
CHANGED
@@ -13,9 +13,11 @@ module Bulldog
|
|
13
13
|
|
14
14
|
reflection = attachment_reflections[name] || Reflection.new(self, name)
|
15
15
|
reflection.configure(&block)
|
16
|
-
attachment_reflections
|
17
|
-
|
18
|
-
|
16
|
+
unless attachment_reflections.key?(name)
|
17
|
+
attachment_reflections[name] = reflection
|
18
|
+
define_attachment_accessors(reflection.name)
|
19
|
+
define_attachment_attribute_methods(reflection.name)
|
20
|
+
end
|
19
21
|
end
|
20
22
|
|
21
23
|
module InstanceMethods
|
data/lib/bulldog/version.rb
CHANGED
@@ -29,7 +29,7 @@ describe HasAttachment do
|
|
29
29
|
Thing.attachment_reflections[:photo].styles[:two].should_not be_blank
|
30
30
|
end
|
31
31
|
|
32
|
-
describe "when an attachment is
|
32
|
+
describe "when an attachment is extended in a subclass" do
|
33
33
|
use_model_class(:Parent)
|
34
34
|
|
35
35
|
before do
|
@@ -41,13 +41,22 @@ describe HasAttachment do
|
|
41
41
|
|
42
42
|
use_model_class(:Child => :Parent)
|
43
43
|
|
44
|
-
|
44
|
+
before do
|
45
45
|
Child.has_attachment :photo do
|
46
46
|
style :two
|
47
47
|
end
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should not affect the superclasses' attachment" do
|
48
51
|
Child.attachment_reflections[:photo].styles[:two].should_not be_blank
|
49
52
|
Parent.attachment_reflections[:photo].styles[:two].should be_blank
|
50
53
|
end
|
54
|
+
|
55
|
+
it "should not define accessors in the subclass, so alias_method_chain can be used in the abstract class" do
|
56
|
+
Child.public_instance_methods(false).map{|s| s.to_sym}.should_not include(:photo)
|
57
|
+
Child.public_instance_methods(false).map{|s| s.to_sym}.should_not include(:photo=)
|
58
|
+
Child.public_instance_methods(false).map{|s| s.to_sym}.should_not include(:photo?)
|
59
|
+
end
|
51
60
|
end
|
52
61
|
end
|
53
62
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bulldog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 4
|
10
|
+
version: 0.2.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- George Ogata
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-07 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|