sinja-sequel 0.1.4 → 0.1.5

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: bf7faf4dabe880c98f5fa92ef61052682d7356fd
4
- data.tar.gz: cb6ee60061b40394040abc77d0b6eb3013db0074
3
+ metadata.gz: 1f6130a46d4d434db90681a9182e327c13550d42
4
+ data.tar.gz: 0a23d5b4651bde8259570ab7672f65b57b885cf2
5
5
  SHA512:
6
- metadata.gz: 52dfb601106827699ea282b58d6b81e696556a797750b5cfc811a39a9b18b00ac5d98d510a3df51e4c14b34d47f16b91ee837d00b1e44afbcb8715c656f658d4
7
- data.tar.gz: 926c9234c0b01ba32d9c63e4c05b0a413cff9241700b0ee7ccdf7169dcf2cbe87328e0c81e4208d6a4915cd18cd9375a5f6fe8ef8483a081e8874632cc5335e8
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>`.
@@ -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 = ->(e) { e.errors.keys.zip(e.errors.full_messages) }
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)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Sinja
3
3
  module Sequel
4
- VERSION = '0.1.4'
4
+ VERSION = '0.1.5'
5
5
  end
6
6
  end
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
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: 2016-12-19 00:00:00.000000000 Z
11
+ date: 2017-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel