activerecord-postgres-json 0.1.1 → 0.1.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/VERSION +1 -1
- data/activerecord-postgres-json.gemspec +3 -3
- data/lib/activerecord-postgres-json/activerecord.rb +28 -29
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 805b94f4d910fc64b531ccfc98bf0ba9394d5b59
|
4
|
+
data.tar.gz: b6615bedfb5ba1c479dfe16058ee7ff0ce070508
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca014d4c22084bcd77590f5013c7a306cfc300810da5ad3fa09d2a69c741e7bf8cc40d2312698042dc5d961786b5d6ff514423bb451011eee00ce7f4529176f7
|
7
|
+
data.tar.gz: 006e6e22717445da67a7f5422bc5a82a1da5b789f530983f29ed58fe02f236a70e053f03aa875c74733071fc5911c17e7bcc2b085bbe3398e0b3dc48b187ede9
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: activerecord-postgres-json 0.1.
|
5
|
+
# stub: activerecord-postgres-json 0.1.2 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "activerecord-postgres-json"
|
9
|
-
s.version = "0.1.
|
9
|
+
s.version = "0.1.2"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Roman Shterenzon"]
|
14
|
-
s.date = "2014-06-
|
14
|
+
s.date = "2014-06-13"
|
15
15
|
s.description = "Active Record support for PostgreSQL JSON type"
|
16
16
|
s.email = "romanbsd@yahoo.com"
|
17
17
|
s.extra_rdoc_files = [
|
@@ -18,9 +18,9 @@ module ActiveRecord
|
|
18
18
|
def extract_value_from_default_with_json(default)
|
19
19
|
case default
|
20
20
|
when "'{}'::json"
|
21
|
-
{}
|
21
|
+
'{}'
|
22
22
|
when "'[]'::json"
|
23
|
-
[]
|
23
|
+
'[]'
|
24
24
|
else
|
25
25
|
extract_value_from_default_without_json(default)
|
26
26
|
end
|
@@ -28,37 +28,36 @@ module ActiveRecord
|
|
28
28
|
alias_method_chain :extract_value_from_default, :json
|
29
29
|
end
|
30
30
|
end
|
31
|
-
end
|
32
31
|
|
33
|
-
|
32
|
+
class TableDefinition
|
33
|
+
|
34
|
+
# Adds json type for migrations. So you can add columns to a table like:
|
35
|
+
# create_table :people do |t|
|
36
|
+
# ...
|
37
|
+
# t.json :info
|
38
|
+
# ...
|
39
|
+
# end
|
40
|
+
def json(*args)
|
41
|
+
options = args.extract_options!
|
42
|
+
column_names = args
|
43
|
+
column_names.each { |name| column(name, 'json', options) }
|
44
|
+
end
|
34
45
|
|
35
|
-
# Adds json type for migrations. So you can add columns to a table like:
|
36
|
-
# create_table :people do |t|
|
37
|
-
# ...
|
38
|
-
# t.json :info
|
39
|
-
# ...
|
40
|
-
# end
|
41
|
-
def json(*args)
|
42
|
-
options = args.extract_options!
|
43
|
-
column_names = args
|
44
|
-
column_names.each { |name| column(name, 'json', options) }
|
45
46
|
end
|
46
47
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
column_names.each { |name| column(name, 'json', options) }
|
48
|
+
class Table
|
49
|
+
|
50
|
+
# Adds json type for migrations. So you can add columns to a table like:
|
51
|
+
# change_table :people do |t|
|
52
|
+
# ...
|
53
|
+
# t.json :info
|
54
|
+
# ...
|
55
|
+
# end
|
56
|
+
def json(*args)
|
57
|
+
options = args.extract_options!
|
58
|
+
column_names = args
|
59
|
+
column_names.each { |name| column(name, 'json', options) }
|
60
|
+
end
|
61
61
|
end
|
62
62
|
end
|
63
|
-
|
64
63
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-postgres-json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roman Shterenzon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|