effective_addresses 1.10.3 → 1.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +0 -2
- data/app/helpers/effective_addresses_helper.rb +2 -0
- data/app/models/effective/address.rb +3 -6
- data/config/effective_addresses.rb +0 -3
- data/db/migrate/{01_create_effective_addresses.rb.erb → 101_create_effective_addresses.rb} +9 -8
- data/lib/effective_addresses/version.rb +1 -1
- data/lib/generators/effective_addresses/install_generator.rb +1 -2
- metadata +90 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a84c53daf0da709a7c9a0e0955a6caa478bbae7f51a0160b8da0c53dd9b1c3c
|
4
|
+
data.tar.gz: f2d4a9d10ecabb3810273a337daad615145ed0fa275cd26bfa27befdee94b71b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f94f011510a25b84edcee947c351dd993c44a6c661ac41e4680bce60761802bc6f40c66ddf39adff6388001b16ca34055674fb4c969c31a16cc51cec185aced
|
7
|
+
data.tar.gz: 171efa37a84a9f6b74cba09197c9520f3db0262cbec987aa106524dfb55298361fcb4da4fbf61f58ce82f8fcfc3d8f8854eac2573b9f1b0929f21d04b5905fa2
|
data/MIT-LICENSE
CHANGED
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 EffectiveAddressesHelper
|
|
15
15
|
case form.class.name
|
16
16
|
when 'Effective::FormBuilder'
|
17
17
|
render partial: 'effective/addresses/form_with', locals: opts
|
18
|
+
when 'Effective::TableBuilder'
|
19
|
+
form.effective_address(method, options)
|
18
20
|
when 'SimpleForm::FormBuilder'
|
19
21
|
render partial: 'effective/addresses/simple_form', locals: opts
|
20
22
|
when 'Formtastic::FormBuilder'
|
@@ -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
|
-
|
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[
|
2
|
-
def
|
3
|
-
create_table
|
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
|
-
|
24
|
-
|
24
|
+
add_index :addresses, [:addressable_type, :addressable_id]
|
25
|
+
add_index :addresses, :addressable_id
|
25
26
|
end
|
26
27
|
end
|
@@ -20,8 +20,7 @@ module EffectiveAddresses
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def create_migration_file
|
23
|
-
|
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.
|
4
|
+
version: 1.11.0
|
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-
|
11
|
+
date: 2023-08-24 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:
|
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:
|
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/
|
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.
|
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
|