activerecord-postgres-json 0.2.0 → 0.2.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
  SHA1:
3
- metadata.gz: b385f869eb3d9e0de150fc2762c1dd04f1d66c0e
4
- data.tar.gz: 86fe3304395044c2c36ba0218851bddbec25c34f
3
+ metadata.gz: 8994f61e8f3c2f0f62053662313b5d928879f696
4
+ data.tar.gz: 9639c733f8fd8b282362f13ed8c72165740ece83
5
5
  SHA512:
6
- metadata.gz: d4c5751709d4ff8b2b10bb9e962d9b0dee214db3cf7e08e488ae52a94dd1bac1fcce72d65352ea6435ecf4282db7cfb7ebd5470525d45c2ec59d5d57b465f596
7
- data.tar.gz: d3a15934cbc4039345e3a295bea2dfe806373648d1aab150af13d246ca85d1cf7e9a986831cbfc0a72b5303d907de4037d4667d1a577939860e2d078954267df
6
+ metadata.gz: 299e502fedc17e9ddece9b00a26c55d56d32f0ba3259ab570a6ccabde3dcea7e53a368c4227d389b39bd6d3288512af5085e87a26ea318343df3a0fe3fa18bce
7
+ data.tar.gz: 5be62b5062003837686dd6adc6f621fcbf8ed92bf1fb7c654bd8d87e73d63496acd992c3b7da849507b8b04802200f5aae5409d4b857fc5b478bf2fd72425034
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
@@ -2,11 +2,11 @@
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.2.0 ruby lib
5
+ # stub: activerecord-postgres-json 0.2.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "activerecord-postgres-json"
9
- s.version = "0.2.0"
9
+ s.version = "0.2.1"
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"]
@@ -9,43 +9,31 @@ module ActiveRecord
9
9
  class PostgreSQLColumn < Column
10
10
  # Adds the json type for the column.
11
11
  def simplified_type_with_json(field_type)
12
- return :json if field_type == 'json'
13
- simplified_type_without_json(field_type)
14
- end
15
-
16
- # Adds the json type for the column.
17
- def simplified_type_with_jsonb(field_type)
18
- return :jsonb if field_type == 'jsonb'
19
- simplified_type_without_jsonb(field_type)
12
+ case field_type
13
+ when 'json'
14
+ :json
15
+ when 'jsonb'
16
+ :jsonb
17
+ else
18
+ simplified_type_without_json(field_type)
19
+ end
20
20
  end
21
21
 
22
22
  alias_method_chain :simplified_type, :json
23
- alias_method_chain :simplified_type, :jsonb
24
23
 
25
24
  class << self
26
25
  def extract_value_from_default_with_json(default)
27
26
  case default
28
- when "'{}'::json"
27
+ when "'{}'::json", "'{}'::jsonb"
29
28
  '{}'
30
- when "'[]'::json"
29
+ when "'[]'::json", "'[]'::jsonb"
31
30
  '[]'
32
31
  else
33
32
  extract_value_from_default_without_json(default)
34
33
  end
35
34
  end
36
35
 
37
- def extract_value_from_default_with_jsonb(default)
38
- case default
39
- when "'{}'::jsonb"
40
- '{}'
41
- when "'[]'::jsonb"
42
- '[]'
43
- else
44
- extract_value_from_default_without_jsonb(default)
45
- end
46
- end
47
36
  alias_method_chain :extract_value_from_default, :json
48
- alias_method_chain :extract_value_from_default, :jsonb
49
37
  end
50
38
  end
51
39
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-postgres-json
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Shterenzon