effective_addresses 1.10.4 → 1.11.1

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
  SHA256:
3
- metadata.gz: aea11fe6ccfab56cc5cf1c40516fea247b016420744623eca7fc407ebc403d2c
4
- data.tar.gz: 283c71d3dc2acb3c8741d772136da776c38e650135ddcc0dd459bb876fddc597
3
+ metadata.gz: cea39f0fbbd41a2fe3102bb1921df46493eb70ff3fec72d044a98787cafd28e5
4
+ data.tar.gz: 11ec3bb2eeca4d3c4fe92d4bea98427aa5168c6da0391a60ab2fad3e80285e88
5
5
  SHA512:
6
- metadata.gz: d16719f448300cc38f15aa97c476c07a407195c82cc8b02af393d6c7257cb1afa82c788ddce63799b8cea32e3dba86dd7328344ecca250e410a18074423d675d
7
- data.tar.gz: 26b170021cacb7f2e2d5c2b8e62fb78ed38b5142ac86aad8cf844238ad606d2c7cfb4608ffd704bdf8318a26d077019e48f5eab19cc7aec0a08b6269c6397de3
6
+ metadata.gz: b78b1a0607d0ae04104dab5fab3d2f75afeeed568d01f6fa4297c7ce94c8a7becd85c1f490d22221a270ccbf46d56828faf72d7e3ec62cecea043cb05ab363fd
7
+ data.tar.gz: 13f3841abe2ade90009e17ce9d6f9192fd6ce43edde87a664651cd602c79274b147380e31c63db7207c3c7293a530c9db1ec1d090d05572f42e811d099e55fe2
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2021 Code and Effect Inc.
1
+ Copyright 2023 Code and Effect Inc.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -10,8 +10,6 @@ Includes a Formtastic and SimpleForm one-liner method to drop in address fields
10
10
 
11
11
  Uses the Carmen gem internally so when a Country is selected, an AJAX request populates the province/state fields as appropriate.
12
12
 
13
- Rails 3.2.x and Rails 4 Support
14
-
15
13
  ## Getting Started
16
14
 
17
15
  Add to your Gemfile:
@@ -15,6 +15,8 @@ module ActsAsAddressable
15
15
  included do
16
16
  has_many :addresses, -> { order(:updated_at) }, as: :addressable, class_name: 'Effective::Address', dependent: :delete_all, autosave: true
17
17
 
18
+ scope :deep_effective_addresses, -> { includes(:addresses) }
19
+
18
20
  # Normalize categories
19
21
  categories = @acts_as_addressable_opts.try(:flatten) || []
20
22
 
@@ -2,7 +2,8 @@
2
2
 
3
3
  module Effective
4
4
  class Address < ActiveRecord::Base
5
- self.table_name = EffectiveAddresses.addresses_table_name.to_s
5
+ self.table_name = (EffectiveAddresses.addresses_table_name || :addresses).to_s
6
+
6
7
  attr_accessor :shipping_address_same_as_billing
7
8
 
8
9
  POSTAL_CODE_CA = /\A[A-Z]{1}\d{1}[A-Z]{1}\ \d{1}[A-Z]{1}\d{1}\z/ # Matches 'T5Z 2B1'
@@ -146,11 +147,7 @@ module Effective
146
147
  end
147
148
 
148
149
  def shipping_address_same_as_billing?
149
- if defined?(::ActiveRecord::ConnectionAdapters::Column::TRUE_VALUES) # Rails 5
150
- ::ActiveRecord::ConnectionAdapters::Column::TRUE_VALUES.include?(shipping_address_same_as_billing)
151
- else
152
- ::ActiveRecord::Type::Boolean.new.cast(shipping_address_same_as_billing)
153
- end
150
+ EffectiveResources.truthy?(shipping_address_same_as_billing)
154
151
  end
155
152
  end
156
153
  end
@@ -1,7 +1,4 @@
1
1
  EffectiveAddresses.setup do |config|
2
- # Database table name to store addresses in. Default is :addresses
3
- config.addresses_table_name = :addresses
4
-
5
2
  # Display Full Name on Address forms, and validate presence by default
6
3
  # (can be overridden on a per address basis)
7
4
  config.use_full_name = true
@@ -1,10 +1,13 @@
1
- class CreateEffectiveAddresses < ActiveRecord::Migration[4.2]
2
- def self.up
3
- create_table <%= @addresses_table_name %> do |t|
1
+ class CreateEffectiveAddresses < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :addresses do |t|
4
4
  t.string :addressable_type
5
5
  t.integer :addressable_id
6
+
6
7
  t.string :category, :limit => 64
8
+
7
9
  t.string :full_name
10
+
8
11
  t.string :address1
9
12
  t.string :address2
10
13
  t.string :address3
@@ -13,14 +16,12 @@ class CreateEffectiveAddresses < ActiveRecord::Migration[4.2]
13
16
  t.string :state_code
14
17
  t.string :country_code
15
18
  t.string :postal_code
19
+
16
20
  t.datetime :updated_at
17
21
  t.datetime :created_at
18
22
  end
19
- add_index <%= @addresses_table_name %>, [:addressable_type, :addressable_id]
20
- add_index <%= @addresses_table_name %>, :addressable_id
21
- end
22
23
 
23
- def self.down
24
- drop_table <%= @addresses_table_name %>
24
+ add_index :addresses, [:addressable_type, :addressable_id]
25
+ add_index :addresses, :addressable_id
25
26
  end
26
27
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveAddresses
2
- VERSION = '1.10.4'.freeze
2
+ VERSION = '1.11.1'.freeze
3
3
  end
@@ -20,8 +20,7 @@ module EffectiveAddresses
20
20
  end
21
21
 
22
22
  def create_migration_file
23
- @addresses_table_name = ':' + EffectiveAddresses.addresses_table_name.to_s
24
- migration_template ('../' * 3) + 'db/migrate/01_create_effective_addresses.rb.erb', 'db/migrate/create_effective_addresses.rb'
23
+ migration_template ('../' * 3) + 'db/migrate/101_create_effective_addresses.rb', 'db/migrate/create_effective_addresses.rb'
25
24
  end
26
25
  end
27
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_addresses
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.4
4
+ version: 1.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-14 00:00:00.000000000 Z
11
+ date: 2023-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 3.2.0
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 3.2.0
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: effective_resources
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +66,90 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: sqlite3
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: devise
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry-byebug
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: effective_test_bot
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: effective_developer
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: psych
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "<"
144
+ - !ruby/object:Gem::Version
145
+ version: '4'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "<"
151
+ - !ruby/object:Gem::Version
152
+ version: '4'
69
153
  description: Extend any ActiveRecord object to have one or more named addresses. Includes
70
154
  a geographic region-aware custom form input backed by Carmen.
71
155
  email:
@@ -91,7 +175,7 @@ files:
91
175
  - config/effective_addresses.rb
92
176
  - config/locales/simple_form.en.yml
93
177
  - config/routes.rb
94
- - db/migrate/01_create_effective_addresses.rb.erb
178
+ - db/migrate/101_create_effective_addresses.rb
95
179
  - lib/effective_addresses.rb
96
180
  - lib/effective_addresses/engine.rb
97
181
  - lib/effective_addresses/version.rb
@@ -117,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
201
  - !ruby/object:Gem::Version
118
202
  version: '0'
119
203
  requirements: []
120
- rubygems_version: 3.1.2
204
+ rubygems_version: 3.3.7
121
205
  signing_key:
122
206
  specification_version: 4
123
207
  summary: Extend any ActiveRecord object to have one or more named addresses. Includes