sinja-sequel 0.1.4 → 0.1.5
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/README.md +5 -3
- data/lib/sinja/sequel/core.rb +7 -1
- data/lib/sinja/sequel/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: 1f6130a46d4d434db90681a9182e327c13550d42
|
4
|
+
data.tar.gz: 0a23d5b4651bde8259570ab7672f65b57b885cf2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4c434c45f126785e659ecb82acbd1c6a47a83abb5bbc0ae9feaf169dbc58a28831c071106872cfabefeb366f5527fb6123831705d76ced489ab772dda2c903f
|
7
|
+
data.tar.gz: 04e1802c3e8370ebe8793bf3db3fcaf756e326a8dad52542f0b4481e5fa6f405203fd24b3b8f04826aad07dba575cecb698c743ed4050f0a2abe7b7ddfbb5b84
|
data/README.md
CHANGED
@@ -104,7 +104,7 @@ prepending Core) to enable pagination!
|
|
104
104
|
Progressively opt-in to Sinja::Sequel's features by enabling (1) Core, (2)
|
105
105
|
Helpers and Core (the most common use-case), or (3) Extension, Helpers, and
|
106
106
|
Core. (Pagination is automatically enabled with Core, but may need to be
|
107
|
-
manually enabled under certain circumstances, detailed below)
|
107
|
+
manually enabled under certain circumstances, detailed below.)
|
108
108
|
|
109
109
|
### Core
|
110
110
|
|
@@ -266,11 +266,13 @@ keywords will generate basic action helpers.
|
|
266
266
|
method to use to cast the ID of the resource or each resource identifier
|
267
267
|
object (`:to_i` by default).
|
268
268
|
|
269
|
-
* The generated `create` action helper does not support client-generated IDs.
|
270
|
-
|
271
269
|
* Optionally define a `settable_fields` helper in each resource that returns an
|
272
270
|
array of symbols to pass to `Sequel::Model#set_fields`.
|
273
271
|
|
272
|
+
* The generated action helpers will be unrestricted by default.
|
273
|
+
|
274
|
+
* The generated `create` action helper does not support client-generated IDs.
|
275
|
+
|
274
276
|
These action helpers can be subsequently overridden, customized by setting
|
275
277
|
action helper options (i.e. `:roles`) and/or defining `before_<action>` hooks,
|
276
278
|
or removed entirely with `remove_<action>`.
|
data/lib/sinja/sequel/core.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require 'forwardable'
|
3
|
+
require 'set'
|
4
|
+
|
3
5
|
require 'sequel'
|
4
6
|
|
5
7
|
require_relative 'pagination'
|
@@ -14,7 +16,11 @@ module Sinja
|
|
14
16
|
c.conflict_exceptions << ::Sequel::ConstraintViolation
|
15
17
|
c.not_found_exceptions << ::Sequel::NoMatchingRow
|
16
18
|
c.validation_exceptions << ::Sequel::ValidationFailed
|
17
|
-
c.validation_formatter =
|
19
|
+
c.validation_formatter = proc do |e|
|
20
|
+
lookup = e.model.class.associations.to_set
|
21
|
+
e.errors.keys.zip(e.errors.full_messages)
|
22
|
+
.map { |a| a << :relationships if lookup.include?(a.first) }
|
23
|
+
end
|
18
24
|
end
|
19
25
|
|
20
26
|
base.prepend Pagination if ::Sequel::Model.db.dataset.respond_to?(:paginate)
|
data/lib/sinja/sequel/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinja-sequel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Pastore
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sequel
|