schema_associations 1.2.3 → 1.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ab213fbc881aef8d05e0b3714f3a63a5de3bc39
4
- data.tar.gz: c927672d92cc4b0107a7d81af6471a3dae77b146
3
+ metadata.gz: 5a6ca1bc960ff609537ddbc4ffcad10ba5cf813c
4
+ data.tar.gz: edc393be28b2f7e1613d6287614de0d0c30b7d5c
5
5
  SHA512:
6
- metadata.gz: c4a53470cb35f36d599e27ff8387ff123cbfd97932b5ab0361f0da13fe1d861d813e2a56739f823b8e7cda2782bd4298adb3759ace20cccdcf55cad621de7522
7
- data.tar.gz: d700a6e564e723158fe0ea474820dc54467314dadd90e2fc0c0a4c2dd326b1e3af59d46b39463d451b03457597130ce03b6a4e22d5203188346eb95c32b1824e
6
+ metadata.gz: 96669b7a7591180b7ae45fb71fd00ea245d00010d6a70622c8a4faf0d40e21de6142f1060089ba3221585ac09e9cd4e7c1d5e0bd622b000b1dfae11664287299
7
+ data.tar.gz: 9822ff73c231ead9a5a9ab932566406dfe52c99c68b556c7db6516165924016fa4beb5bea54cf7b77d910adf71a21604d2ea1c3c53e6e2dce78a21fc6d1b1d2a
data/README.md CHANGED
@@ -358,6 +358,10 @@ Code coverage results will be in coverage/index.html -- it should be at 100% cov
358
358
 
359
359
  ## Release notes:
360
360
 
361
+ ### 1.2.4
362
+
363
+ * Bug fix: Don't fail trying to do associations for abstract classes (mysql2 only). [#11, #12] Thanks to [@dmeranda](https://github.com/dmeranda)
364
+
361
365
  ### 1.2.3
362
366
 
363
367
  * Use schema_plus_foreign_keys rather than all of schema_plus, to eliminate unneeded dependancies. That limits us to AR >= 4.1 and ruby >= 2.1
@@ -80,6 +80,7 @@ module SchemaAssociations
80
80
  def _load_schema_associations_associations #:nodoc:
81
81
  return if @schema_associations_associations_loaded
82
82
  @schema_associations_associations_loaded = true
83
+ return if abstract_class?
83
84
  return unless schema_associations_config.auto_create?
84
85
 
85
86
  reverse_foreign_keys.each do | foreign_key |
@@ -1,3 +1,3 @@
1
1
  module SchemaAssociations
2
- VERSION = "1.2.3"
2
+ VERSION = "1.2.4"
3
3
  end
@@ -637,6 +637,27 @@ describe ActiveRecord::Base do
637
637
  end
638
638
 
639
639
 
640
+ context "with abstract base classes" do
641
+ before(:each) do
642
+ create_tables(
643
+ "posts", {}, {}
644
+ )
645
+ class PostBase < ActiveRecord::Base ; self.abstract_class = true ; end
646
+ class Post < PostBase ; end
647
+ end
648
+
649
+ it "should skip abstract classes" do
650
+ expect { PostBase.table_name }.to_not raise_error
651
+ expect( PostBase.table_name ).to be_nil
652
+ expect( !! PostBase.table_exists? ).to eq(false)
653
+ end
654
+
655
+ it "should work with classes derived from abstract classes" do
656
+ expect( Post.table_name ).to eq("posts")
657
+ expect( !! Post.table_exists? ).to eq(true)
658
+ end
659
+ end
660
+
640
661
  if defined? ::ActiveRecord::Relation
641
662
 
642
663
  context "regarding relations" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schema_associations
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ronen Barzel
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-09-06 00:00:00.000000000 Z
12
+ date: 2015-11-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: schema_plus_foreign_keys