dragonfly 0.5.5 → 0.5.6
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.txt +7 -0
- data/VERSION +1 -1
- data/dragonfly.gemspec +1 -1
- data/lib/dragonfly/active_record_extensions/class_methods.rb +4 -1
- data/spec/dragonfly/active_record_extensions/migration.rb +7 -0
- data/spec/dragonfly/active_record_extensions/model_spec.rb +26 -0
- data/spec/dragonfly/active_record_extensions/models.rb +5 -1
- metadata +2 -2
data/History.txt
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.6
|
data/dragonfly.gemspec
CHANGED
@@ -35,7 +35,10 @@ module Dragonfly
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def dragonfly_apps_for_attributes
|
38
|
-
@dragonfly_apps_for_attributes ||=
|
38
|
+
@dragonfly_apps_for_attributes ||= begin
|
39
|
+
parent_class = ancestors[1]
|
40
|
+
parent_class.respond_to?(:dragonfly_apps_for_attributes) ? parent_class.dragonfly_apps_for_attributes.dup : {}
|
41
|
+
end
|
39
42
|
end
|
40
43
|
|
41
44
|
end
|
@@ -545,5 +545,31 @@ describe Item do
|
|
545
545
|
end
|
546
546
|
end
|
547
547
|
end
|
548
|
+
|
549
|
+
describe "inheritance" do
|
550
|
+
before(:all) do
|
551
|
+
@app = Dragonfly::App[:images]
|
552
|
+
ActiveRecord::Base.register_dragonfly_app(:image, @app)
|
553
|
+
Car.class_eval do
|
554
|
+
image_accessor :image
|
555
|
+
end
|
556
|
+
ReliantRobin.class_eval do
|
557
|
+
image_accessor :reliant_image
|
558
|
+
end
|
559
|
+
end
|
560
|
+
it "should allow assigning base class accessors" do
|
561
|
+
Car.create! :image => 'blah'
|
562
|
+
end
|
563
|
+
it "should not allow assigning subclass accessors in the base class" do
|
564
|
+
Car.new.should_not respond_to(:reliant_image=)
|
565
|
+
end
|
566
|
+
it "should allow assigning base class accessors in the subclass" do
|
567
|
+
ReliantRobin.create! :image => 'blah'
|
568
|
+
end
|
569
|
+
it "should allow assigning subclass accessors in the subclass" do
|
570
|
+
ReliantRobin.create! :reliant_image => 'blah'
|
571
|
+
end
|
572
|
+
|
573
|
+
end
|
548
574
|
|
549
575
|
end
|