activerecord-bixformer 0.4.6 → 0.4.7

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
  SHA1:
3
- metadata.gz: ebdeb4d0ee7e10859c4a8d348ebcc505bf286d19
4
- data.tar.gz: 805e0d16206bd0b33fad2e78dd412a3c300541d9
3
+ metadata.gz: eed4299b6586e43d9a42327f8ed6b1f84567ca3c
4
+ data.tar.gz: 55d4d7d1e7bc7e1bdc285141946b65f47c4d27ee
5
5
  SHA512:
6
- metadata.gz: 8b179a6a9c55b795c791fdb8e746d9b05e772f32dbd2f3241d52da8e36c96e2945b011eb38fe9309a5410e341e0bd46989c4165144f43882142dae3da980c318
7
- data.tar.gz: 41e2e7330629c0d28fd899e587a3bf0264e128d1c23b9d48f1fb3bdbc5dafa1a8e5a1a3995f3e83bfc15f06b99209d7a007cebfbcd40e61d365f05338a8af766
6
+ metadata.gz: 1b339983f68ab9f1dd111939afbcd57eb0eb7e7521c25cc4c9235ced30fccf38199bd21dbc82b91041cc4e924a6945a495d39be0c4d2721cfd07538f99cee186
7
+ data.tar.gz: 504b0010f3801df782e930c3643bfafe91aadbc159849e5721cad93df0da3fbecdad139981c944aa7ea75ba5e404cf8a6f408c6a48591628015e2ed6f7bb313c
@@ -86,15 +86,9 @@ module ActiveRecord
86
86
  private
87
87
 
88
88
  def foreign_constant
89
- @foreign_constant ||= -> do
90
- reflection = @model.activerecord_constant.reflections.values.find { |r| r.foreign_key == @name }
91
-
92
- if reflection.respond_to?(:class_name)
93
- reflection.class_name.constantize
94
- else
95
- reflection.table_name.classify.constantize
96
- end
97
- end.call
89
+ @foreign_constant ||= @model.activerecord_constant
90
+ .reflections.values.find { |r| r.foreign_key == @name }
91
+ .class_name.constantize
98
92
  end
99
93
  end
100
94
  end
@@ -77,7 +77,7 @@ module ActiveRecord
77
77
  def activerecord_constant
78
78
  @activerecord_constant ||=
79
79
  if @parent
80
- @parent.activerecord_constant.reflections[@name].table_name.classify.constantize
80
+ @parent.activerecord_constant.reflections[@name].class_name.constantize
81
81
  else
82
82
  @name.camelize.constantize
83
83
  end
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module Bixformer
3
- VERSION = "0.4.6"
3
+ VERSION = "0.4.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-bixformer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroaki Otsu