caprese 0.3.10 → 0.3.11
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 +4 -0
- data/lib/caprese/controller/concerns/query.rb +4 -2
- data/lib/caprese/version.rb +1 -1
- 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: 0a9e6756d45e03f3c91b1c6481aec5b57032a103
|
4
|
+
data.tar.gz: 70d8e1b6c043dab986369ac84c3cf2912a44700d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c144ac674470aeeabecd13910a0ec0ec3cd6ce2a3621c7c2eccc75783aeceb9f2996b2dff1b85e42ba5155db19b39307214a647a0c834a58df0edd3e3ff95a4
|
7
|
+
data.tar.gz: dd3a0c1156512e15efd759a8cc03d8d76695ff9db17a3098884939c6c42578f5cea864436a2edad6e7bb2dca46038be85d378b7dc92988e8fd91880e2ad5de84
|
data/CHANGELOG.md
CHANGED
@@ -102,7 +102,7 @@ module Caprese
|
|
102
102
|
def get_record(scope, column, value)
|
103
103
|
scope = record_scope(scope.to_sym) unless scope.respond_to?(:find_by)
|
104
104
|
|
105
|
-
scope.find_by(column => value)
|
105
|
+
scope.find_by(column => value) unless scope.empty?
|
106
106
|
end
|
107
107
|
|
108
108
|
# Gets a record in a scope using a column/value to search by
|
@@ -113,7 +113,7 @@ module Caprese
|
|
113
113
|
scope = record_scope(scope.to_sym) unless scope.respond_to?(:find_by!)
|
114
114
|
|
115
115
|
begin
|
116
|
-
scope.find_by!(column => value)
|
116
|
+
scope.find_by!(column => value) unless scope.is_a?(Array) && scope.empty?
|
117
117
|
rescue ActiveRecord::RecordNotFound => e
|
118
118
|
fail RecordNotFoundError.new(
|
119
119
|
field: column,
|
@@ -128,6 +128,8 @@ module Caprese
|
|
128
128
|
# @param [Relation] scope the scope to apply sorting and pagination to
|
129
129
|
# @return [Relation] the sorted and paginated scope
|
130
130
|
def apply_sorting_pagination_to_scope(scope)
|
131
|
+
return scope if scope.empty?
|
132
|
+
|
131
133
|
if query_params[:sort].try(:any?)
|
132
134
|
ordering = {}
|
133
135
|
query_params[:sort].each do |sort_field|
|
data/lib/caprese/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caprese
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Landgrebe
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-02-
|
13
|
+
date: 2017-02-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: active_model_serializers
|