set_as_primary 0.1.2 → 0.1.3
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 +4 -4
- data/CHANGELOG.md +3 -1
- data/README.md +1 -1
- data/lib/generators/set_as_primary/set_as_primary_generator.rb +2 -2
- data/lib/set_as_primary/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b410c90868639a2814d0d217615e4aab6629ecfd95b8d4c2807682f441196b1
|
4
|
+
data.tar.gz: c23232116cbd213ab9e89efe63a2b4952fc27e2948bac8173309913414d9443b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d63e1a3a0a41c023e23ab5153a1cfd6f58ad3457fe3e6ca48c51245c958ec96d2b62fd04e1af27355cd0e42e37685245c2c09f40fae65e35c8e239f8ac2d412
|
7
|
+
data.tar.gz: ad973cfdab0ac3dded4f7bf1b33fa5e5df8942a494a4c7d0b22f36edff253d20c764e2c762d28c355e8bb972091655d69dfd4b1de99cbc76372e42e8674d9e14
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
+
## 0.1.3 (2019-02-02)
|
2
|
+
- Fixed index_on issue.
|
3
|
+
|
1
4
|
## 0.1.2 (2019-02-02)
|
2
5
|
- Supported unique partial index.
|
3
6
|
- Changed generator definition. Now it also accepts `flag_name`, `owner_key`.
|
4
7
|
- Handled `force_primary` in `after_create` callback.
|
5
8
|
- Refactored the code.
|
6
|
-
|
7
9
|
## 0.1.1 (2019-12-29)
|
8
10
|
|
9
11
|
- Added support for single model with no association.
|
data/README.md
CHANGED
@@ -121,7 +121,7 @@ class AddPrimaryColumnToEmailAddresses < ActiveRecord::Migration[6.0]
|
|
121
121
|
def change
|
122
122
|
add_column :email_addresses, :primary, :boolean, default: false, null: false
|
123
123
|
# NOTE: Please uncomment following line if you want only one 'true' (constraint) in the table.
|
124
|
-
# add_index :email_addresses, %i[user_id
|
124
|
+
# add_index :email_addresses, %i[user_id primary], unique: true, where: "(email_addresses.primary IS TRUE)"
|
125
125
|
end
|
126
126
|
end
|
127
127
|
```
|
@@ -38,9 +38,9 @@ module SetAsPrimary
|
|
38
38
|
|
39
39
|
if owner_association.options[:polymorphic]
|
40
40
|
owner_type_key = "#{owner_key}_type"
|
41
|
-
"%i[#{owner_id_key}
|
41
|
+
"%i[#{owner_id_key} #{owner_type_key} #{flag_name}]"
|
42
42
|
else
|
43
|
-
"%i[#{owner_id_key}
|
43
|
+
"%i[#{owner_id_key} #{flag_name}]"
|
44
44
|
end
|
45
45
|
else
|
46
46
|
":#{flag_name}"
|