frozen_record 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -4
- data/lib/frozen_record/base.rb +4 -1
- data/lib/frozen_record/scope.rb +4 -1
- data/lib/frozen_record/version.rb +1 -1
- data/spec/scope_spec.rb +3 -2
- 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: e3ad807dcab80676636ab54fc06c01f5a20358b9
|
4
|
+
data.tar.gz: 252b2ef0891b9b62b62616317f1ef5ac4d378abe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7d43b151b30c11aba06de403a8eace5f49c970f7e11c7501d85775ecd2bb9fae194f2569f00d291d0db11e75e5a96deee74aeddcb66bd2e1433fa113cae5247
|
7
|
+
data.tar.gz: 82e9a979804003d0143c945fa17b71cc7f23614100c95bfa79fa414b7ac7e4ff66091cfbc2f97eec88d3748188efacb291659eed182659c770ed12855e0e1c80
|
data/.travis.yml
CHANGED
data/lib/frozen_record/base.rb
CHANGED
@@ -6,7 +6,10 @@ module FrozenRecord
|
|
6
6
|
include ActiveModel::Conversion
|
7
7
|
include ActiveModel::AttributeMethods
|
8
8
|
include ActiveModel::Serializers::JSON
|
9
|
-
|
9
|
+
|
10
|
+
if defined? ActiveModel::Serializers::Xml
|
11
|
+
include ActiveModel::Serializers::Xml
|
12
|
+
end
|
10
13
|
|
11
14
|
FIND_BY_PATTERN = /\Afind_by_(\w+)(!?)/
|
12
15
|
FALSY_VALUES = [false, nil, 0, ''].to_set
|
data/lib/frozen_record/scope.rb
CHANGED
@@ -6,7 +6,10 @@ module FrozenRecord
|
|
6
6
|
:keep_if, :pop, :shift, :delete_at, :compact
|
7
7
|
].to_set
|
8
8
|
|
9
|
-
delegate :first, :last, :length, :collect, :map, :each, :all?, :include?, :to_ary, :to_json, :
|
9
|
+
delegate :first, :last, :length, :collect, :map, :each, :all?, :include?, :to_ary, :to_json, :as_json, to: :to_a
|
10
|
+
if defined? ActiveModel::Serializers::Xml
|
11
|
+
delegate :to_xml, to: :to_a
|
12
|
+
end
|
10
13
|
|
11
14
|
class WhereChain
|
12
15
|
def initialize(scope)
|
data/spec/scope_spec.rb
CHANGED
@@ -392,8 +392,9 @@ describe 'querying' do
|
|
392
392
|
describe '.to_xml' do
|
393
393
|
|
394
394
|
it 'serialize the results' do
|
395
|
-
|
396
|
-
|
395
|
+
skip('ActiveModel::Serializers::Xml is not defined (Active Model 5+ ?)') unless defined? ActiveModel::Serializers::Xml
|
396
|
+
xml = Country.all.to_xml
|
397
|
+
expect(xml).to be == Country.all.to_a.to_xml
|
397
398
|
end
|
398
399
|
|
399
400
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: frozen_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean Boussier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02
|
11
|
+
date: 2016-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|