schema_associations 1.2.5 → 1.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -1
- data/README.md +9 -4
- data/gemfiles/activerecord-4.2/Gemfile.base +1 -1
- data/gemfiles/activerecord-4.2/Gemfile.mysql2 +2 -2
- data/gemfiles/activerecord-5.0/Gemfile.base +3 -0
- data/gemfiles/activerecord-5.0/Gemfile.mysql2 +10 -0
- data/gemfiles/activerecord-5.0/Gemfile.postgresql +10 -0
- data/gemfiles/activerecord-5.0/Gemfile.sqlite3 +10 -0
- data/lib/schema_associations/active_record/associations.rb +2 -1
- data/lib/schema_associations/version.rb +1 -1
- data/schema_associations.gemspec +1 -1
- data/schema_dev.yml +4 -3
- data/spec/association_spec.rb +1 -1
- metadata +9 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c080f0a0fd14c82a61269dc1eb6e1e111ed1c331
|
4
|
+
data.tar.gz: 6e0a834bf340751c07ec3614ca34a712c35e884e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06b8e5871f6cb1ee9751571a739a05560c2f5f6d787450e3c69d893e3fa2cb43875778e1f7022c6d5436baba937ddbb29e903bba0de1798904bb7743c9fa3328
|
7
|
+
data.tar.gz: 4101db526873abab3e101e0bf8852f55372c272fe9c116169243a676d278455defe4c18b752c6fcf71d6ba99c54154084fe8dc851b792bb2af8aa5b860d8ddc4
|
data/.travis.yml
CHANGED
@@ -5,11 +5,14 @@
|
|
5
5
|
---
|
6
6
|
sudo: false
|
7
7
|
rvm:
|
8
|
-
- 2.1
|
8
|
+
- 2.3.1
|
9
9
|
gemfile:
|
10
10
|
- gemfiles/activerecord-4.2/Gemfile.mysql2
|
11
11
|
- gemfiles/activerecord-4.2/Gemfile.postgresql
|
12
12
|
- gemfiles/activerecord-4.2/Gemfile.sqlite3
|
13
|
+
- gemfiles/activerecord-5.0/Gemfile.mysql2
|
14
|
+
- gemfiles/activerecord-5.0/Gemfile.postgresql
|
15
|
+
- gemfiles/activerecord-5.0/Gemfile.sqlite3
|
13
16
|
env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER=travis
|
14
17
|
addons:
|
15
18
|
postgresql: '9.4'
|
data/README.md
CHANGED
@@ -87,7 +87,7 @@ class Post < ActiveRecord::Base
|
|
87
87
|
end
|
88
88
|
```
|
89
89
|
|
90
|
-
You can also pass options as described in [
|
90
|
+
You can also pass options as described in [Configuration](#configuration)
|
91
91
|
|
92
92
|
## Full Details
|
93
93
|
|
@@ -303,7 +303,7 @@ end
|
|
303
303
|
|
304
304
|
## Table names, model class names, and modules
|
305
305
|
|
306
|
-
SchemaAssociations
|
306
|
+
SchemaAssociations determines the model class name from the table name using the same convention (and helpers) that ActiveRecord uses. But sometimes you might be doing things differently. For example, in an engine you might have a prefix that goes in front of all table names, and the models might all be namespaced in a module.
|
307
307
|
|
308
308
|
To that end, SchemaAssociations lets you configure mappings from a table name prefix to a model class name prefix to use instead. For example, suppose your database had tables:
|
309
309
|
|
@@ -336,7 +336,7 @@ end
|
|
336
336
|
|
337
337
|
Tables names that don't start with `hpy_` will continue to use the default determination.
|
338
338
|
|
339
|
-
You can set up multiple mappings. E.g. if you're using several engines they can each set up the mapping for their own
|
339
|
+
You can set up multiple mappings. E.g. if you're using several engines they can each set up the mapping for their own modules.
|
340
340
|
|
341
341
|
You can set up a mapping from or to the empty string, in order to unconditionally add or remove prefixes from all model class names.
|
342
342
|
|
@@ -418,7 +418,8 @@ SchemaAssociations is tested on all combinations of:
|
|
418
418
|
|
419
419
|
<!-- SCHEMA_DEV: MATRIX - begin -->
|
420
420
|
<!-- These lines are auto-generated by schema_dev based on schema_dev.yml -->
|
421
|
-
* ruby **2.1
|
421
|
+
* ruby **2.3.1** with activerecord **4.2**, using **mysql2**, **postgresql** or **sqlite3**
|
422
|
+
* ruby **2.3.1** with activerecord **5.0**, using **mysql2**, **postgresql** or **sqlite3**
|
422
423
|
|
423
424
|
<!-- SCHEMA_DEV: MATRIX - end -->
|
424
425
|
|
@@ -453,6 +454,10 @@ Code coverage results will be in coverage/index.html -- it should be at 100% cov
|
|
453
454
|
|
454
455
|
## Release notes:
|
455
456
|
|
457
|
+
### 1.2.6
|
458
|
+
|
459
|
+
* Support for AR5 (Rails 5).
|
460
|
+
|
456
461
|
### 1.2.5
|
457
462
|
|
458
463
|
* Use schema_monkey rather than Railties.
|
@@ -70,7 +70,6 @@ module SchemaAssociations
|
|
70
70
|
|
71
71
|
def _load_schema_associations_associations
|
72
72
|
return if @schema_associations_associations_loaded
|
73
|
-
@schema_associations_associations_loaded = true
|
74
73
|
return if abstract_class?
|
75
74
|
return unless schema_associations_config.auto_create?
|
76
75
|
|
@@ -90,6 +89,8 @@ module SchemaAssociations
|
|
90
89
|
foreign_keys.each do | foreign_key |
|
91
90
|
_define_association(:belongs_to, foreign_key)
|
92
91
|
end
|
92
|
+
|
93
|
+
@schema_associations_associations_loaded = true
|
93
94
|
end
|
94
95
|
|
95
96
|
def _define_association(macro, fk, referencing_table_name = nil)
|
data/schema_associations.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
|
|
21
21
|
|
22
22
|
s.add_dependency("schema_plus_foreign_keys", "~> 0.1")
|
23
23
|
|
24
|
-
s.add_development_dependency("schema_dev", "~> 3.
|
24
|
+
s.add_development_dependency("schema_dev", "~> 3.6")
|
25
25
|
s.add_development_dependency("rake")
|
26
26
|
s.add_development_dependency("rdoc")
|
27
27
|
s.add_development_dependency("rspec")
|
data/schema_dev.yml
CHANGED
data/spec/association_spec.rb
CHANGED
@@ -696,7 +696,7 @@ describe ActiveRecord::Base do
|
|
696
696
|
|
697
697
|
def create_tables(*table_defs)
|
698
698
|
ActiveRecord::Migration.suppress_messages do
|
699
|
-
ActiveRecord::Base.connection.
|
699
|
+
ActiveRecord::Base.connection.tables_only.each do |table|
|
700
700
|
ActiveRecord::Migration.drop_table table, force: :cascade
|
701
701
|
end
|
702
702
|
table_defs.each_slice(3) do |table_name, opts, columns_with_options|
|
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.6
|
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: 2016-
|
12
|
+
date: 2016-09-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: schema_plus_foreign_keys
|
@@ -31,14 +31,14 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '3.
|
34
|
+
version: '3.6'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '3.
|
41
|
+
version: '3.6'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rake
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -132,6 +132,10 @@ files:
|
|
132
132
|
- gemfiles/activerecord-4.2/Gemfile.mysql2
|
133
133
|
- gemfiles/activerecord-4.2/Gemfile.postgresql
|
134
134
|
- gemfiles/activerecord-4.2/Gemfile.sqlite3
|
135
|
+
- gemfiles/activerecord-5.0/Gemfile.base
|
136
|
+
- gemfiles/activerecord-5.0/Gemfile.mysql2
|
137
|
+
- gemfiles/activerecord-5.0/Gemfile.postgresql
|
138
|
+
- gemfiles/activerecord-5.0/Gemfile.sqlite3
|
135
139
|
- init.rb
|
136
140
|
- lib/schema_associations.rb
|
137
141
|
- lib/schema_associations/active_record/associations.rb
|
@@ -160,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
160
164
|
version: '0'
|
161
165
|
requirements: []
|
162
166
|
rubyforge_project: schema_associations
|
163
|
-
rubygems_version: 2.
|
167
|
+
rubygems_version: 2.5.1
|
164
168
|
signing_key:
|
165
169
|
specification_version: 4
|
166
170
|
summary: ActiveRecord extension that automatically (DRY) creates associations based
|