schema_associations 1.2.3 → 1.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.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/schema_associations/active_record/associations.rb +1 -0
- data/lib/schema_associations/version.rb +1 -1
- data/spec/association_spec.rb +21 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a6ca1bc960ff609537ddbc4ffcad10ba5cf813c
|
4
|
+
data.tar.gz: edc393be28b2f7e1613d6287614de0d0c30b7d5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 |
|
data/spec/association_spec.rb
CHANGED
@@ -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.
|
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-
|
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
|