better_record 0.10.1 → 0.10.2
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/db/migrate/20180518042050_create_better_record_db_functions.rb +2 -2
- data/lib/better_record/version.rb +1 -1
- data/lib/core_ext/array.rb +9 -0
- data/lib/core_ext/boolean.rb +0 -6
- data/lib/core_ext/object.rb +4 -0
- data/lib/templates/migration/templates/create_table_migration.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f6c701ce3492212c79ccdf60ec86a1dea60b264c1a5e5952fe5c42b0b6eaaf7
|
4
|
+
data.tar.gz: 9614fda8762227624a58c7e34733a0bca69cc0656e28b6e166fb4010d4a27571
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9224d9d3fc1b864f0a3b7f5f0599d1f44a02740e5d0d4626476914462bb328c3fb799cdf7b6b6d6ea0046ef681ca75aedd9ca6175168140fdb753c2788919b4b
|
7
|
+
data.tar.gz: ed05b77cfe9fdf8cbd55daa38f0a96469bb0bca60ce3972d601b1d50706bdcdcaee031fcdf57e003c8f900633f4b6f5cf3815f6698d1296010efd1421edce96e
|
@@ -83,7 +83,7 @@ class CreateBetterRecordDBFunctions < ActiveRecord::Migration[5.2]
|
|
83
83
|
SQL
|
84
84
|
|
85
85
|
execute <<-SQL
|
86
|
-
CREATE OR REPLACE FUNCTION unique_random_string(table_name text, column_name text, string_length integer)
|
86
|
+
CREATE OR REPLACE FUNCTION unique_random_string(table_name text, column_name text, string_length integer default 6, prefix text default '')
|
87
87
|
RETURNS text AS
|
88
88
|
$BODY$
|
89
89
|
DECLARE
|
@@ -98,7 +98,7 @@ class CreateBetterRecordDBFunctions < ActiveRecord::Migration[5.2]
|
|
98
98
|
|
99
99
|
LOOP
|
100
100
|
|
101
|
-
key :=
|
101
|
+
key := prefix;
|
102
102
|
iterator := 0;
|
103
103
|
|
104
104
|
WHILE iterator < string_length
|
data/lib/core_ext/boolean.rb
CHANGED
data/lib/core_ext/object.rb
CHANGED
@@ -7,7 +7,7 @@ class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Mi
|
|
7
7
|
<% elsif attribute.token? -%>
|
8
8
|
t.string :<%= attribute.name %><%= attribute.inject_options %>
|
9
9
|
<% else -%>
|
10
|
-
t.<%= attribute.type %> :<%= attribute.name %><%= attribute.type == :
|
10
|
+
t.<%= attribute.type %> :<%= attribute.name %><%= attribute.type.in?(%i[ references boolean ]) ? ', null: false' : '' %><%= attribute.type == :boolean ? ', default: false' : '' %><%= attribute.inject_options %>
|
11
11
|
<% end -%>
|
12
12
|
<% end -%>
|
13
13
|
<% if options[:timestamps] %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: better_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sampson Crowley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -294,6 +294,7 @@ files:
|
|
294
294
|
- lib/better_record/tasks/better_record/install.rake
|
295
295
|
- lib/better_record/tasks/spec/attributes.rake
|
296
296
|
- lib/better_record/version.rb
|
297
|
+
- lib/core_ext/array.rb
|
297
298
|
- lib/core_ext/boolean.rb
|
298
299
|
- lib/core_ext/object.rb
|
299
300
|
- lib/generators/better_record/eject_rspec_extensions/USAGE
|