dragonfly 0.6.0 → 0.6.1

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.0
1
+ 0.6.1
data/dragonfly.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{dragonfly}
8
- s.version = "0.6.0"
8
+ s.version = "0.6.1"
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-11}
12
+ s.date = %q{2010-05-16}
13
13
  s.email = %q{mark@new-bamboo.co.uk}
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE",
@@ -36,11 +36,11 @@ module Dragonfly
36
36
 
37
37
  def dragonfly_apps_for_attributes
38
38
  @dragonfly_apps_for_attributes ||= begin
39
- parent_class = ancestors[1]
39
+ parent_class = ancestors.select{|a| a.is_a?(Class) }[1]
40
40
  parent_class.respond_to?(:dragonfly_apps_for_attributes) ? parent_class.dragonfly_apps_for_attributes.dup : {}
41
41
  end
42
42
  end
43
-
43
+
44
44
  end
45
45
  end
46
46
  end
@@ -27,7 +27,11 @@ class MigrationForTest < ActiveRecord::Migration
27
27
  t.string :reliant_image_uid
28
28
  t.string :type
29
29
  end
30
-
30
+
31
+ create_table :photos do |t|
32
+ t.string :image_uid
33
+ end
34
+
31
35
  end
32
36
 
33
37
  def self.down
@@ -546,29 +546,52 @@ describe Item do
546
546
  end
547
547
 
548
548
  describe "inheritance" do
549
+
549
550
  before(:all) do
550
551
  @app = Dragonfly::App[:images]
552
+ @app2 = Dragonfly::App[:egg]
551
553
  Dragonfly.active_record_macro(:image, @app)
554
+ Dragonfly.active_record_macro(:egg, @app2)
552
555
  Car.class_eval do
553
556
  image_accessor :image
554
557
  end
555
- ReliantRobin.class_eval do
558
+ Photo.class_eval do
559
+ egg_accessor :image
560
+ end
561
+
562
+ @base_class = Car
563
+ @subclass = Class.new(Car){ image_accessor :reliant_image }
564
+ @subclass_with_module = Class.new(Car) do
565
+ include Module.new
556
566
  image_accessor :reliant_image
557
567
  end
568
+ @unrelated_class = Photo
558
569
  end
570
+
559
571
  it "should allow assigning base class accessors" do
560
- Car.create! :image => 'blah'
572
+ @base_class.create! :image => 'blah'
561
573
  end
562
574
  it "should not allow assigning subclass accessors in the base class" do
563
- Car.new.should_not respond_to(:reliant_image=)
575
+ @base_class.new.should_not respond_to(:reliant_image=)
564
576
  end
565
577
  it "should allow assigning base class accessors in the subclass" do
566
- ReliantRobin.create! :image => 'blah'
578
+ @subclass.create! :image => 'blah'
567
579
  end
568
580
  it "should allow assigning subclass accessors in the subclass" do
569
- ReliantRobin.create! :reliant_image => 'blah'
581
+ @subclass.create! :reliant_image => 'blah'
582
+ end
583
+ it "should allow assigning base class accessors in the subclass, even if it has mixins" do
584
+ @subclass_with_module.create! :image => 'blah'
585
+ end
586
+ it "should allow assigning subclass accessors in the subclass, even if it has mixins" do
587
+ @subclass_with_module.create! :reliant_image => 'blah'
588
+ end
589
+ it "return the correct apps for each accessors, even when names clash" do
590
+ @base_class.dragonfly_apps_for_attributes.should == {:image => @app}
591
+ @subclass.dragonfly_apps_for_attributes.should == {:image => @app, :reliant_image => @app}
592
+ @subclass_with_module.dragonfly_apps_for_attributes.should == {:image => @app, :reliant_image => @app}
593
+ @unrelated_class.dragonfly_apps_for_attributes.should == {:image => @app2}
570
594
  end
571
-
572
595
  end
573
596
 
574
597
  end
@@ -2,5 +2,5 @@ class Item < ActiveRecord::Base
2
2
  end
3
3
  class Car < ActiveRecord::Base
4
4
  end
5
- class ReliantRobin < Car
5
+ class Photo < ActiveRecord::Base
6
6
  end
@@ -5,6 +5,23 @@
5
5
  <%= erb(:headers) %>
6
6
  </head>
7
7
  <body>
8
+
9
+ <!-- GOOGLE ANALYTICS -->
10
+ <script type="text/javascript">
11
+
12
+ var _gaq = _gaq || [];
13
+ _gaq.push(['_setAccount', 'UA-16382932-1']);
14
+ _gaq.push(['_trackPageview']);
15
+
16
+ (function() {
17
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
18
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
19
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
20
+ })();
21
+
22
+ </script>
23
+ <!-- *************** -->
24
+
8
25
  <script type="text/javascript" charset="utf-8">
9
26
  if (window.top.frames.main) document.body.className = 'frames';
10
27
  </script>
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 6
8
- - 0
9
- version: 0.6.0
8
+ - 1
9
+ version: 0.6.1
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-11 00:00:00 +01:00
17
+ date: 2010-05-16 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency