active-dbml 0.2.3 → 0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 883f97dab6da278ac16901b94d60b2288cbcad0dc84fda907c6f316fd4de5859
4
- data.tar.gz: bf8cf386d3a53c7aa3dd04f5704ab50fa6fbb695d1c81eeeb266d109d416bbad
3
+ metadata.gz: 8c3e035fb9fbf2783cffe7222a4675df48bf99a242c2b32a970244c0a6757640
4
+ data.tar.gz: c0b9e975256b8fa43b5f692f242423be0132ef8c3d4297be35e29e4509af12a9
5
5
  SHA512:
6
- metadata.gz: 60e2e63cbd3c2c932430388a6c99bb8ba7a634097e50cbe9d0c0c950c13d1cdd0885f9bf28140d139156ab61c418fe36cdf69b63939757a9035face489641184
7
- data.tar.gz: 00ab782368ffdeabbd31b0e3c2ee94d1a08dc23ee5aed42456eb4233e9864d94d4b0583c7d4c396d0d947316f3a3f3f9c19c2c0aa5301a10824add607c380e85
6
+ metadata.gz: eca3036cced74a86f8df57295d74288af90830b36cf225248c6ed5f697a7dd14eda1f33b04ad9527e010180c05d55ebf74eb42635ae3359a7c65817e2ee16e5a
7
+ data.tar.gz: '0378667f33007af8d6d0b961bacfaad68dff98028c32241ae17b4c6ec04829acf42f5fdd37074d3840c78f25bf0ac036b6c25650a0503d382effbf21a54bf4f8'
@@ -1,5 +1,5 @@
1
1
  module Active
2
2
  module Dbml
3
- VERSION = "0.2.3"
3
+ VERSION = "0.2.4"
4
4
  end
5
5
  end
data/lib/active/dbml.rb CHANGED
@@ -63,14 +63,14 @@ module Active
63
63
  # get foreign key only belongs_to association
64
64
  model.reflect_on_all_associations(:belongs_to).each do |association|
65
65
  begin
66
+ foreign_key = association.foreign_key
67
+ foreign_key_destination = "#{association.plural_name}.#{association.class_name.constantize.primary_key}"
68
+
66
69
  # NOTE: Check model type
67
70
  # Skip anything other than ActiveRecord::Base
68
71
  if association.class_name.constantize < ActiveRecord::Base
69
72
  association.class_name.constantize.reflect_on_all_associations.each do |relation_association|
70
73
  if model.table_name.eql?(relation_association.plural_name)
71
- foreign_key = association.options[:foreign_key]
72
- foreign_key_destination = "#{association.plural_name}.#{association.class_name.constantize.primary_key}"
73
-
74
74
  case relation_association.macro
75
75
  when :has_one
76
76
  foreign_keys[foreign_key] = { destination: foreign_key_destination, relation_type: '-' }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active-dbml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - ukmshi