activerecord-bixformer 0.4.18 → 0.4.19

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: ae6888312a21e7d9354ae7c46e4b8fc9e87aa4c2
4
- data.tar.gz: bb36394798a5fa42d748f1c2a50ca8ea8fe19fa0
3
+ metadata.gz: 440c53f937e017a28463e594ffc9057a3f2b1b03
4
+ data.tar.gz: 112e9462e462dacadd0661cba1cda7166df41029
5
5
  SHA512:
6
- metadata.gz: 1995b2cb22b6f1569df73e0b284af26926e2425170a7be0e6db97b6efab7d20f21129960f2165ca09376c2853a5fd13878e8a320b1e9bf07e7b85abb37bb3044
7
- data.tar.gz: a7d635b60db5b21c39640f455a380e07401ba241c078548793be9b7a780a0d5f5b82d76f1761269e68814cdf0662c87d5a1416f839ed50e5cde0cde85557b214
6
+ metadata.gz: 59a354bdf15342906e8154b0f744b29fbab11c97da83dd0e5ba204f805f814174c69f2c84a662beea39c4a81f465a30631f5e284a7a4aa25065e1cf67073e44c
7
+ data.tar.gz: 16beecf99c514c544cba9307e6c7f1a735a6faaff159323b9e9670e4faf2becf985de8b247dff407de8d06694a16fa0f782c49679d67c3cbc043e792ff0a5074
@@ -151,6 +151,8 @@ module ActiveRecord
151
151
 
152
152
  run_bixformer_callback :import, type: :attribute do
153
153
  @attributes.each do |attr|
154
+ next if attr.options[:skip_import]
155
+
154
156
  attribute_value = begin
155
157
  run_bixformer_callback :import, on: attr.name do
156
158
  block.call(attr)
@@ -20,10 +20,14 @@ module ActiveRecord
20
20
  end
21
21
 
22
22
  def verify_csv_titles(csv_title_row)
23
- attribute_names = activerecord_constant.attribute_names
23
+ verified_attribute_names = if options[:verified_csv_titles]
24
+ options[:verified_csv_titles].map(&:to_s)
25
+ else
26
+ activerecord_constant.attribute_names
27
+ end
24
28
 
25
29
  @attributes
26
- .select { |attr| attribute_names.include?(attr.name) }
30
+ .select { |attr| verified_attribute_names.include?(attr.name) }
27
31
  .map { |attr| csv_title(attr.name) }
28
32
  .all? { |title| csv_title_row.include?(title) } &&
29
33
  @associations.all? { |ass| ass.verify_csv_titles(csv_title_row) }
@@ -45,7 +49,7 @@ module ActiveRecord
45
49
  values = run_bixformer_callback :export, type: :attribute do
46
50
  # has_one でしか使わない想定なので record_or_relation は ActiveRecord::Base のはず
47
51
  @attributes.map do |attr|
48
- attribute_value = if record_or_relation
52
+ attribute_value = if record_or_relation && ! attr.options[:skip_export]
49
53
  run_bixformer_callback :export, on: attr.name do
50
54
  attr.export(record_or_relation)
51
55
  end
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module Bixformer
3
- VERSION = "0.4.18"
3
+ VERSION = "0.4.19"
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.18
4
+ version: 0.4.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroaki Otsu